freeCodeCamp/curriculum/challenges/arabic/02-javascript-algorithms-an.../functional-programming/use-the-some-method-to-chec...

1.2 KiB

id title challengeType videoUrl localeTitle
587d7dab367417b2b2512b6f Use the some Method to Check that Any Elements in an Array Meet a Criteria 1

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'assert(code.match(/\.some/g), "Your code should use the <code>some</code> method.");'
  - text: ''
    testString: 'assert(checkPositive([1, 2, 3, -4, 5]), "<code>checkPositive([1, 2, 3, -4, 5])</code> should return <code>true</code>.");'
  - text: ''
    testString: 'assert(checkPositive([1, 2, 3, 4, 5]), "<code>checkPositive([1, 2, 3, 4, 5])</code> should return <code>true</code>.");'
  - text: ''
    testString: 'assert(!checkPositive([-1, -2, -3, -4, -5]), "<code>checkPositive([-1, -2, -3, -4, -5])</code> should return <code>false</code>.");'

Challenge Seed

function checkPositive(arr) {
  // Add your code below this line


  // Add your code above this line
}
checkPositive([1, 2, 3, -4, 5]);

Solution

// solution required