3数组的队列方法

    var colors=["red","blue","yellow","black"]
//push()方法,向数组的最后一项插入相关的项,插在最后的项之后。i获取到的是该数组的长度。 var i=colors.push("gray","purple")
//pop()方法,取得数组的最后一项,其中item获取到的是移除的项。 var item=colors.pop()
//unshift()方法,向数组的首项插入相关的项,插在首项之前 colors.unshift("orange")
//shift()方法,取得数组的首项 colors.shift()
//以上方法在数组的相关应用中非常实用
//另外还要注意concat()方法,concat()方法一般用来连接数组与数组,push等则用来连接数组与元素。

 

posted @ 2016-03-21 15:54  上啊比卡丘  阅读(194)  评论(0编辑  收藏  举报