hi All,
I have question around Douglas Crockford "method" method.
this is it. But here arises question regarding return this?
what does mean here return this? this method works even if without return this this line. I have read about that. so that one say that it is for chaining. But i didnt understand how can i use chaining using this "method" function. Thanks in advance for attention. I will wait your responses!
I have question around Douglas Crockford "method" method.
Code:
Function.prototype.method = function (name, func) { this.prototype[name] = func; return this; }; function azerizor(value) { this.value=value; } azerizor.method('toString', function () { return this.value; }); var me = new azerizor('salam').toString(); alert(me);
what does mean here return this? this method works even if without return this this line. I have read about that. so that one say that it is for chaining. But i didnt understand how can i use chaining using this "method" function. Thanks in advance for attention. I will wait your responses!
Comment