form-cheatsheet/js/polyfills/EcmaScript/Array.prototype.filter.js

2 lines
327 B
JavaScript

Array.prototype.filter=function(c){if(!this||!this)throw new TypeError;var b=Object(this),f=b.length>>>0;if("function"!==typeof c)throw new TypeError;for(var d=[],g=2<=arguments.length?arguments[1]:void 0,a=0;a<f;a++)if(a in b){var e=b[a];c.call(g,e,a,b)&&d.push(e)}return d};
//# sourceMappingURL=Array.prototype.filter.js.map