日期:2014-05-16 浏览次数:20434 次
	var num = [40,10,8,2,5];
	num.sort(function (var1, var2) {
		return var2 - var1;
	});
	var colors = ['red', 'blue'];
	
	var copied = colors.concat();
	alert(copied);
	
	var newColors = colors.concat('yellow', ['white', 'black']);
	alert(newColors);
var colors = ['red', 'blue', 'yellow', 'white', 'black']; var newColors = colors.slice(2); // 'yellow', 'white', 'black' alert(newColors); newColors = colors.slice(1, 4); // 'blue', 'yellow', 'white' alert(newColors);