I'm doing the tutorials for functional programming on the nodeschool-homepage. I'm new to JS (came from Java) so I don't get some aspects of JS, for example:
function say(word) {
return function(anotherWord) {
console.log(anotherWord);
}
}
If I call:
say("hi"); // it returns nothing
say("hi", "hi"); // it returns nothing
var said = say("hi"); // asignment
said("hi"); // returns hi -- but why?
said(); // returns undefined;
Can someone explain to me how the "hi" in the outer function is passed in the inner function?