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

2 lines
352 B
JavaScript

Array.prototype.includes=function(c,a){if(!this)throw new TypeError("Array.prototype.includes called on null or undefined");var e=Object(this),d=parseInt(e.length,10)||0;if(!d)return!1;a=parseInt(a,10)||0;0<=a||(a=d+a,0>a&&(a=0));for(var b;a<d;){b=e[a];if(c===b||c!==c&&b!==b)return!0;a++}return!1};
//# sourceMappingURL=Array.prototype.includes.js.map