标题 js 数组的常用方法
<script>
var a = [1, 2, 3];
document.write(a.unshift(10) + "<br>");
document.write(a.shift() + "<br>");
document.write(a.push(9) + "<br>");
document.write(a.pop() + "<br>");
var b = [3, 1, 3];
var c = a.concat(b);
document.write(c.indexOf(3) + "<br>");
document.write(c.lastIndexOf(3) + "<br>");
document.write(c.slice(1, 3) + "<br>");
document.write(c.splice(2, 3, 5) + "<br>");
var d = [1, 3, 6, 2, 5];
document.write(d.sort() + "<br>");
document.write(d.reverse() + "<br>");
</script>