Array.prototype.every polyfill

Array.prototype.every = function(functorTruthTest){ return this.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

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.