IE 11 Script1002 Array.Filter(x => ...)(箭头功能) [英] IE 11 Script1002 Array.Filter(x => ...) (Arrow functions)

查看:106
本文介绍了IE 11 Script1002 Array.Filter(x => ...)(箭头功能)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 IE11 中收到错误消息,但在chrome中没有错误消息:

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


Script1002语法错误

Script1002 Syntax error

我的代码如下

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

错误的行号和列号表明它是箭头函数 => IE11 不喜欢。但是它在 Chrome Edge

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

推荐答案

中工作正常支持箭头功能

尝试

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

这篇关于IE 11 Script1002 Array.Filter(x => ...)(箭头功能)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆