My previous understand of Closures is bad.
Some of his code:
var createGreeting = function(greeting) {
return function (name) {
document.write(greeting + ', ' + name + '.');
};
};
helloGreeting = createGreeting("Hello");
howdyGreeting = createGreeting("Howdy");
helloGreeting("John"); |
// Hello, John. |
No comments:
Post a Comment