L
L
lavezzi12016-07-05 18:58:25
JavaScript
lavezzi1, 2016-07-05 18:58:25

Object doesn't support property or method 'find'?

Hello, in IE9-11 this error pops up. On the project I use wepback + babel.
An error like this pops up

Object doesn't support property or method 'find'

Code that highlights IE11
var row = father.processedSmartBody.find(byId(id));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2016-07-05
@lavezzi1

1) maybe you have an object, not an array
2) there is no such method in IE. Connect babel-polyfill either separately

if (!Array.prototype.find) {
  Array.prototype.find = function(predicate) {
    if (this == null) {
      throw new TypeError('Array.prototype.find called on null or undefined');
    }
    if (typeof predicate !== 'function') {
      throw new TypeError('predicate must be a function');
    }
    var list = Object(this);
    var length = list.length >>> 0;
    var thisArg = arguments[1];
    var value;

    for (var i = 0; i < length; i++) {
      value = list[i];
      if (predicate.call(thisArg, value, i, list)) {
        return value;
      }
    }
    return undefined;
  };
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question