Array Every Method

Video

JavaScript Notes

JavaScript
    // Array every( ) method
    // checks EVERY element to see if it’s true
    
    let number = [40, 16, 67, 345, 22, 23, 142, 63, 59, 283);
     
    let greaterThan20 = numbers.every(function(num) { 
        return num > 20;
    } );
    console.log (greaterThan20); // returns false (not every element is greater than 20)
    
    let greaterThan10 = numbers.every(function(num) { 
        return num > 10;
    } );
    console.log ('\n', greaterThan10); // returns true (every element is greater than 10)