数组操作函数(方法)
<script type="text/javascript">
// 数组操作函数(方法)
// 数组合并函数:concat()
// 结构:concat(item1,item2 ……)
var a,b,c,d
a=[1,2,3,4,5]
b=Array(6,7,8,9,10)
c=["php","html","js","jq"]
document.write(a.concat(b)+"<br>")
document.write(a.concat(b,c)+"<br>")
// 将数组元素变成字符串,并且以指定分割符号分割 join()
document.write(c.join(">")+"<br>")
// 删除元素并向数组添加新元素 splice(起始位置,删除个数,新元素)
document.write(c.splice(1,1,"web前端")+"<br>")
document.write(c+"<br>")
// 从数组中返回选定的元素 slice(起始位置,终止)
document.write(c.slice(0,2)+"<br>")
// push()向数组末尾添加一个或者多个元素,并返回一个新数组的长度
document.write(c.push("push")+"<br>")
document.write(c+"<br>")
// pop() 删除并且返回数组的最后一个元素
document.write(b.pop()+"<br>")
document.write(b+"<br>")
</script>