Now I am reading JavaScript - The Good Parts. Therefore, I am dealing with an increase in types. I understand motivation and implementation. But if I look at the code ...
Function.prototype.method = function(ident, funct) { this.prototype[ident] = funct; return this;
... then I do not understand the purpose of the return. I returned the comments in the comments. It does not affect. It functioned anyway.
My full code is:
Function.prototype.method = function(ident, funct) { this.prototype[ident] = funct; return this; }; Date.method('sayHello', function() { alert(new Date().toString()); }); var myDate = new Date(); myDate.sayHello();
What is this for?
source share