有个js的数组问题(初级问题)

是这样的,我定义了一个数组
var a=["a","b","c"]
当用delete a[1]后数组a的游标1就不可用,用for(i=0;i<a.length;i++)alert(a[i])时,a[1]就等于undefine,用for(i in a)alert(a[i]),a[1]就被跳过去了.
问题是,有没有办法使delete a[1]后,后面的游标会动态的调整.这里只是个小例子,希望能提供更好的方法,可能对js还是不熟,有更好的属性和方法没用到,向大家请教!
---------------------------------------------------------------

倒,还错

a.splice(1,1)

Published At
Categories with Web编程
comments powered by Disqus