shyam
answered Nov 30 '-1 00:00
you cant call like this
javascript.every();
because it need callback function to pass as argument in every function in JavaScript
every function iterate every value untill it get true from call back function .
var javascript = ["i",'am',"javascript"]
javascript.every(function iterate(value){
alert(value);
return true;
});
it give you three alread for "i",'am',"javascript"
var javascript = ["i",'am',"javascript"]
javascript.every(function iterate(value){
alert(value);
});
it give you one alert because it dont return anything means return false in first iteration so after first iteration it does not call second time.
Usage::
mostly iterate through array with callback function
Example
suppose if you find all array value should be not empty in JavaScript or find even or odd value from array etc..