IE8中是否支持javascript .map()功能? [英] Is the javascript .map() function supported in IE8?

查看:579
本文介绍了IE8中是否支持javascript .map()功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这样做:

var a = new Array("a", "b");
a.map(function() { });

在IE8中我得到:

"Object doesn't support this property or method"

这是IE8中不支持方法,还是有其他问题?我已经有了Google,但是收到了很多Google Maps javascript问题/问题...

Is this method not supported in IE8, or do I have some other problem? I've had a Google, but get lots of Google Maps javascript issues/questions...

编辑:OK IE8及以下DO不支持.map()函数。从MDN复制粘贴代码 here 如果不是原生支持的(它似乎可以正常工作),那么将根据规范将.map()函数添加到Array原型。

Edit: OK so IE8 and below DO NOT support the .map() function. Copy-paste the code from MDN here which will add the .map() function to the Array prototype exactly per the specs if not natively supported (and it seems to work perfectly).

推荐答案

IE8不支持 map()。如有疑问,请检查MDN(Mozilla开发人员网络):

IE8 doesn't support map(). When in doubt, check MDN (Mozilla Developer Network):

地图 - MDN

看起来IE已经支持 map() / code>在版本9。

Looks like IE added support for map() in version 9.

这篇关于IE8中是否支持javascript .map()功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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