JSFiddle - React, Tailwind, and code Playground
JavaScript
var arraryValida = [0, 2, 0, 0];
var arraryInvalida = [0, 1, 0, 0];
var valor = 2;
function testeFor(arr, match) {
for (var x = 0, l = arr.length; x < l; x++) {
if (arr[x] >= match) return true;
}
return false;
}
function testeMax(arr, match) {
return Math.max.apply(Math.max, arr) >= match;
}
function testeSome(arr, match) {
return arr.some(nr => nr >= match);
}
[testeFor, testeMax, testeSome].forEach(function(fn, i) {
console.log(fn.call(null, arraryValida, valor));
console.log(fn.call(null, arraryInvalida, valor));
console.log(i, '----');
});