0

I get a syntax error when using this line of code in IE11.

let themes = _.filter(data, (el) => {
    if (OrganizationId == 21) {
        return el.Code == 'skin-3';
    } else {
        return el.Code != 'skin-3';
    }
});
VLAZ
  • 26,331
  • 9
  • 49
  • 67
Amr Elnashar
  • 1,739
  • 12
  • 33
  • 53
  • See this post => https://stackoverflow.com/questions/40216015/why-doesnt-this-arrow-function-work-in-ie-11 – daddygames Nov 04 '20 at 14:06
  • Does this answer your question? [Why doesn't this arrow function work in IE 11?](https://stackoverflow.com/questions/40216015/why-doesnt-this-arrow-function-work-in-ie-11) – Ruben Helsloot Nov 04 '20 at 16:18

1 Answers1

0

You're using arrow function which is not supported by IE and let statement which is partial supported by IE.

I suggest that you transpile the code to ES5 syntax using Babel. You can convert the code to below to make it work in IE 11:

var themes = _.filter(data, function (el) {
  if (OrganizationId == 21) {
    return el.Code == 'skin-3';
  } else {
    return el.Code != 'skin-3';
  }
});
Yu Zhou
  • 11,532
  • 1
  • 8
  • 22
  • see [How to create IE11 Bundles with Webpack 5 and Babel 7](https://stackoverflow.com/questions/65035451/how-to-create-ie11-bundles-with-webpack-5-and-babel-7) – anthumchris Nov 27 '20 at 17:51