IE 11 Script1002 Array.Filter(x => ...) (Arrow functions)

MicroMan picture MicroMan · Jul 26, 2016 · Viewed 32k times · Source

I get a error message in IE11 but not in chrome the error is:

Script1002 Syntax error

My code is as follows

var selectedRoles = vm.roles.filter(x => x.id === role.id);

The line and column number of the error suggest that it is the arrow function => that IE11 does not like. However it works fine in Chrome and Edge

Answer

Grundy picture Grundy · Jul 26, 2016

ie 11 not support arrow functions

try

var selectedRoles = vm.roles.filter(function(x) { return x.id === role.id; });