Practice
JavaScriptData StructuresReactConcepts
Sign in
← Back to problems

some and every

Working With Arraysmedium

Course · Section 11: Working With Arrays · Lecture 169: some and every

Implement `checks(arr)` returning `[anyPositive, allPositive]` using `some` and `every`.

Sample tests

Input: checks([-1,2,3])
Output: [true,false]
Input: checks([1,2])
Output: [true,true]

+ 1 hidden test run on Submit.

Hints

Common pitfalls
  • every returns true for an empty array (vacuously).
Approach & explanation (try first)

some reports whether any element is positive and every whether all are.

Loading...
⌘/Ctrl + Enter

Run your code to see results.