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

1.2 KiB

id title challengeType videoUrl localeTitle
587d7dab367417b2b2512b6e Use the every Method to Check that Every Element in an Array Meets a Criteria 1

Description

undefined

Instructions

undefined

Tests

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