Answer the question
In order to leave comments, you need to log in
Misunderstood class declaration?
Good morning, habralyudi!
I came across this code:
var Greeter = (function () {
function Greeter(message) {
this.greeting = message;
}
Greeter.prototype.greet = function () {
return "Hello, " + this.greeting;
};
return Greeter;
})();
var Greeter = function(message) {
this.greeting = message;
}
Greeter.prototype.greet = function () {
return "Hello, " + this.greeting;
};
Answer the question
In order to leave comments, you need to log in
It's just that the class declaration is framed by a closure so as not to "hook" anything from the outside.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question