摘要: 1.Array 的pop,push方法pop 方法移除数组中的最后一个元素并返回该元素。var a=[1,2,3,4]a.pop()alert(a)alert(a.pop())push 方法将新元素添加到一个数组中,并返回数组的新长度值。参数arrayObj必选项。一个 Array 对象。item, item2,. . . itemN可选项。该 Array 的新元素。var a=[1,2,3,4]a.push(5)alert(a)alert(a.push(6))unshift 方法将指定的元素插入数组开始位置并返回该数组。splice 方法从一个数组中移除一个或多个元素,如果必要,在所移除元素 阅读全文
posted @ 2012-02-10 14:29 林锋 阅读(8107) 评论(0) 推荐(1) 编辑
摘要: Array.prototype.slice.call(arguments,0)就类似于arguments.slice(0),但因为arguments不是真正的Array,所以它没有slice这个方法.能用slice方法的,只要有length属性就行。虽然arguments有length属性,但是没有slice方法,所以呢,Array.prototype.slice()执行的时候,Array.prototype已经被call改成arguments了,因为满足slice执行的条件(有length属性),所以没有报错。 阅读全文
posted @ 2012-02-10 14:08 林锋 阅读(208) 评论(0) 推荐(0) 编辑