The book that I'm studying says about iterating over arrays with every
that:
The function these methods use must follow one rule—it must accept three arguments like the following code:
function functionName(value, index, array) { // do something here }
Does that mean that I must always use 3 arguments? If so then why does this code work?
var numbers = [ 1, 2, 2 ];
function isLessThan3(value) {
var returnValue = false;
if (value < 3) {
returnValue = true;
}
return returnValue; }
document.write(numbers.every(isLessThan3));