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.
- Use the
.some()method. - Return
trueif the array contains any negative numbers, otherwisefalse.
01EXAMPLE 1
Input
nums = [1, 2, -1, 3]Output
trueConstraints
- Use the .some() method.
CoreArrays
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
nums[1,2,-1,3]
Expected Output
true
Click RUN to test your solution