一段js,求解释,该如何解决
一段js,求解释
------解决方案--------------------
(function(){
if (!Function.prototype.bind) { //判断有没有加过bind属性
alert(1);
Function.prototype.bind = function(obj){
alert(2);
var owner = this, args = Array.prototype.slice.call(arguments),
(function(){
if (!Function.prototype.bind) {
alert(1);
Function.prototype.bind = function(obj){
alert(2);
var owner = this, args = Array.prototype.slice.call(arguments),
callobj = Array.prototype.shift.call(args);
return function(e){
alert(1);
e = e || top.window.event || window.event;
owner.apply(callobj, args.concat([e]));
};
};
}
})();
------解决方案--------------------
(function(){
if (!Function.prototype.bind) { //判断有没有加过bind属性
alert(1);
Function.prototype.bind = function(obj){
alert(2);
var owner = this, args = Array.prototype.slice.call(arguments),