var Visitor = {}
Visitor .push = function(){
return Array.prototype.push.apply( this, arguments );
}
var obj = {};
obj.push = Visitor .push;
obj.push( '"first" );
alert ( obj[0] )
//"first"
alert ( obj.length );
Array.prototype.push结合apply 实现 object 伪装数组
最新推荐文章于 2023-01-17 17:44:47 发布