If any item in an array passes code example
Example: If any item in an array passes
let marks = [ 4, 5, 7, 9, 10, 3 ];
let lessThanFive = false;
for (let index = 0; index < marks.length; index++) {
if (marks[index] < 5) {
lessThanFive = true;
break;
}
}
console.log(lessThanFive);Code language: JavaScript (javascript)