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等则用来连接数组与元素。

 

相关文章:

  • 2021-10-11
  • 2021-07-06
  • 2022-12-23
  • 2022-01-05
  • 2021-08-04
猜你喜欢
  • 2021-06-02
  • 2022-12-23
  • 2022-02-14
  • 2021-05-31
  • 2021-12-06
相关资源
相似解决方案