The Exception Detector

Easy+15 XP

Mission Briefing

The reactor core scanners are attempting to detect if there is any breach. Even a single anomaly means a total lockdown! You must deploy a function to check for any exceptions.

The Concept: Does 'Some' Exist?

The .some() method tests whether at least one element in the array passes the test. It returns a boolean! Example: [1, 2, 3].some(x => x === 2); // true

The Objective

Your function receives an array nums.

  1. Use the .some() method.
  2. Return true if the array contains any negative numbers, otherwise false.

01EXAMPLE 1

Inputnums = [1, 2, -1, 3]
Outputtrue

Constraints

  • Use the .some() method.
CoreArrays
JavaScript
Loading...
3 Hidden

Input Arguments

nums[1,2,-1,3]

Expected Output

true

Click RUN to test your solution