在JavaScript中有6种数据类型:string,number,null,undefined,boolean,object.
Array对象的indexOf方法在FF下是支持的,IE下是不支持的。
所有有的时候需要手动添加一个indexOf方法。代码如下:
上面就是为Array添加indexOf方法的方法。
给一个节点设置属性的方法有 setAttribute,prototype,onclick,addEventListener
本文介绍JavaScript中Array对象的indexOf方法,特别关注该方法在不同浏览器中的兼容性问题,并提供了一个简单的实现来确保在不支持此方法的老版Internet Explorer中也能使用。
在JavaScript中有6种数据类型:string,number,null,undefined,boolean,object.
Array对象的indexOf方法在FF下是支持的,IE下是不支持的。
所有有的时候需要手动添加一个indexOf方法。代码如下:
上面就是为Array添加indexOf方法的方法。
给一个节点设置属性的方法有 setAttribute,prototype,onclick,addEventListener
839
1万+
1728

被折叠的 条评论
为什么被折叠?