87,907
社区成员
发帖
与我相关
我的任务
分享
merge: function( first, second ) {
var i = first.length, j = 0;
if ( typeof second.length === "number" ) { //
for ( var l = second.length; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
}
lz在研究jquery的底层吧,记得上一次也是问jquery底层代码的
底层的代码是将数组2的元素添加的数组1中,数组中存放的对象也是被++添加到数组1中的