1

I am getting a script error in ie8 for an array object. The error is : "Object doesnt support property or method 'indexOf'

Anyone have an idea or info on how to best solve this for ie8?

Thanks

 var arr = new Array();
 Array.prototype.remove = function() {
 var what, a = arguments, L = a.length, ax;
 while (L && this.length) {
    what = a[--L];
    while ((ax = this.indexOf(what)) !== -1) {
        this.splice(ax, 1);
    }
   }
  return this;
};
gregdevs
  • 703
  • 2
  • 11
  • 37
  • 2
    it is not supported in IE8.. You need to add a pollyfill. Check this https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill – PSL Jan 23 '14 at 22:36
  • 4
    Unlike most IE error messages, this one pretty much nails it. – Pointy Jan 23 '14 at 22:36
  • Take the polyfill implementation from the corresponding MDN page: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf#Polyfill – zerkms Jan 23 '14 at 22:36

0 Answers0