日期:2014-05-16 浏览次数:20412 次
<strong>var colors = ["red", "blue", "green"]; alert(colors); // red,blue,green colors2 = colors.join("-"); alert(colors2);//red-blue-green </strong>
var colors = ["red", "blue", "green"]; var length = colors.push("white"); alert(colors); //red,blue,green,white alert(length); //4
var colors = ["red", "blue", "green"]; var color = colors.pop(); alert(colors); //red,blue alert(color); //green
var colors = ["red", "blue", "green"]; var colors2 = colors.concat(["white", "2"]); alert(colors2); //red,blue,green,white,2
var colors = ["red", "blue", "green"]; var colors2 = colors.slice(1); var colors3 = colors.slice(0,1); alert(colors2); //blue,green alert(colors3); //red