array.splice
来源:互联网 发布:win7优化内存 编辑:程序博客网 时间:2024/06/05 03:02
array.splice() in Internet Explorer
I finally got around to investigating an IE bug I’ve been meaning to look into. The root cause was a difference between JScript and ECMAScript as regards array.splice(). The signature for this handy method that removes and inserts array elements in place:
splice(start, deleteCount, value, ...)
According to the standard, only start (the index at which to start removing elements) is a required argument. So:
var a = ["e1", "e2", "e3"];
a.splice(1);
should result in a
being a single-element array containing “e1″. But of course, IE does not see it that way. According to MSDN, deleteCount is also required argument. Thus, the above would have to be:
var a = ["e1", "e2", "e3"];
a.splice(1, a.length-1);
It didn’t take too long to figure this out, but Google let me down and didn’t turn up anything about this. It’s been a long time since I had to turn to the MSDN reference docs. Maybe this tip will help someone…at the very least, it’ll help me remember!
- array.splice
- Actionscript3.0 Array splice slice
- js利用splice处理Array
- JavaScript Array 对象splice() 方法
- JavaScript Array: slice vs splice
- Array.prototype.splice方法重写
- js splice方法----Array的方法
- JavaScript Array.splice()和slice()的区别
- JavaScript Array.splice方法替换问题
- 利用Array.splice实现Array的insert/remove
- js利用Array.splice实现Array的insert/remove
- JS的array.slice()和array.splice()的使用
- Splice
- splice
- 利用Array的splice方法,删除数组的元素
- Array.splice()--删除数组中重复的数据
- 有关ActionScript的Array类的splice函数
- JavaScript 数组array 插入[ push() ] 与 删除[ splice() ]
- 函数指针与指针函数以及结构体调用函数的方法
- Think php 引用类 和一些引说明
- Sicily 1036. Crypto Columns
- 关于IOS多线程的简单总结
- Java json reflect Bean
- array.splice
- 【酷站商业模式】AdWhirl:iPhone软件内嵌广告
- Sicily 1200. Stick
- fiddler
- 黑莓开发第一步(中文+HelloWord)
- AdWhirl 介绍及加入方法 Android
- 在Gnome下让GVim自动最大化
- Dwr入门开发
- 泛型的逆变和抗变