The Javascript Array.every() method tests whether all the elements of an array satisfy the given condition (a callback passed in by the user).
In essence, the
every()method executes the callback function for each element of the array and returnstrueif all elements returntrueorfalseif only one element returnsfalse.
const isBelowThreshold = (currentValue) => currentValue < 40;
const array1 = [1, 30, 39, 29, 10, 13];
console.log(array1.every(isBelowThreshold));
// Expected output: true
You can read more about every() method here.