Javascript Array Question 1 check value

Introduction

We would like to find out if any array element value is less than 3.

let numbers = [ 1, 2, 3, 4, 5 ]; 
//your code here
console.log();


let numbers = [ 1, 2, 3, 4, 5 ]; 
function isLessThan3(value, index, array) { 
    let returnValue = false; 

    if (value < 3) { 
        returnValue = true; 
    } 

    return returnValue; 
} 

console.log(numbers.every(isLessThan3)); 



PreviousNext

Related