Array.prototype.unshift

/*
官网原文:
Array.unshift prepends its arguments to the start of the array and is supposed to return the length of the resultant array. The returned value of this function call in JScript is “undefined”.
*/
// 将指定的元素插入数组开始位置并返回该数组。


	var a = new Array(1, 2, 3); 
	var l = a.unshift();
	document.write(l, " "); 
	document.write(a.length, " "); 
	document.write(a, " ");
	l = a.unshift(2); 
	document.write(l, " "); 
	document.write(a.length, " ");
	document.write(a, " ");
/*
    Output: 
        IE: undefined 3 1,2,3 undefined 4 2,1,2,3 
        FF: 3 3 1,2,3 4 4 2,1,2,3 
        Opera: same as FF 
       Safari: same as FF
*/

你可能感兴趣的:(prototype,IE,Opera,Safari)