请问这段js代码是什么意思
Function.prototype.overloadSetter = function(usePlural){ var self = this; return function(a, b){ if (a == null) return this; if (usePlural || typeof a != 'string'){ for (var k in a) { self.call(this, k, a[k]); } } else { self.call(this, a, b); } return this; }; }; [color=#FF0000]Function.prototype.extend = function(key, value){ this[key] = value; }.overloadSetter();[/color] function x() { } x.extend('a',1);
<script type="text/javascript">Function.prototype.overloadSetter = function(usePlural) { var self = this; return function(a, b) { if (a == null) return this; if (usePlural || typeof a != 'string') { for ( var k in a) { self.call(this, k, a[k]); } } else { self.call(this, a, b); } return this; };};var fun2 = function(key, value) { this[key] = value;};var fun3 = fun2.overloadSetter();alert(fun3);//这才是x.extend('_a', 11)真正调用的函数Function.prototype.extend = fun3;function x() {}<script type="text/javascript">Function.prototype.overloadSetter = function(usePlural) { var self = this; return function(a, b) { if (a == null) return this; if (usePlural || typeof a != 'string') { for ( var k in a) { self.call(this, k, a[k]); } } else { self.call(this, a, b); } return this; };};var fun2 = function(key, value) { this[key] = value;};var fun3 = fun2.overloadSetter();alert(fun3);//这才是x.extend('_a', 11)真正调用的函数Function.prototype.extend = fun3;function x() {}var f = x.extend('_a', 11);</script>var f = x.extend('_a', 11);</script>
[解决办法]