<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
function jquery(o)
{
if(this === window)return new jquery(o);
this.length = 0;
Array.prototype.push.apply(this, o);
}jquery.prototype.each = function(fn)
{
var i,a = this;
for(i = 0; i < a.length; i++)
fn.apply(a[i], [a[i], a]);
};var a = jquery([433,44,366]);
a.each(function()
{alert(this)//弹出433 44 366
});
Function.prototype.bind = function(o)
{
var _f = this, a = [];
Array.prototype.push.apply(a, arguments);
a.shift();//88
return function()
{
var b = [];
Array.prototype.push.apply(b, arguments);;
_f.apply(o || _f, a.concat(b));
};
};function kk()
{
var a = [];
Array.prototype.push.apply(a, arguments)
alert(a.join("\n"));
// 这里可以体现多态
this.each(function()
{
alert(this + 10);
});
}var test1 = kk.bind(a, 44,88)(66);
//test1(66);
</script>
<script>
function jquery(o)
{
if(this === window)return new jquery(o);
this.length = 0;
Array.prototype.push.apply(this, o);
}jquery.prototype.each = function(fn)
{
var i,a = this;
for(i = 0; i < a.length; i++)
fn.apply(a[i], [a[i], a]);
};var a = jquery([433,44,366]);
a.each(function()
{alert(this)//弹出433 44 366
});
Function.prototype.bind = function(o)
{
var _f = this, a = [];
Array.prototype.push.apply(a, arguments);
a.shift();//88
return function()
{
var b = [];
Array.prototype.push.apply(b, arguments);;
_f.apply(o || _f, a.concat(b));
};
};function kk()
{
var a = [];
Array.prototype.push.apply(a, arguments)
alert(a.join("\n"));
// 这里可以体现多态
this.each(function()
{
alert(this + 10);
});
}var test1 = kk.bind(a, 44,88)(66);
//test1(66);
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货