Array.prototype.every = Array.prototype.every || function(functorTruthTest, thisArg){
thisArg = thisArg || this;
return thisArg.reduce(function(acc, elem, index, arr){
return acc && functorTruthTest(elem, index, arr);
}, true);
}
A quick polyfill to include Array.prototype.every to browsers that don't support it
requirements: must support Array.prototype.reduce
#2: added thisArg support and test if already supported
requirements: must support Array.prototype.reduce
#2: added thisArg support and test if already supported
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.