11/13: Why No Need to Call Function This Time?


#1

Hi,

Was confused like others by this one -- viz., http://discuss.codecademy.com/t/console-log-the-results-of-a-function-11-13-introduction-to-functions-in-js/1275/2 -- but the reason why is this:

So far, we've been taught by Code Academy/Leng Lee (the author of these lessons) that we have to call a function and then use console.log to display its output. But why not here??

Why does the heretofore normal, usual

nameString("David");
console.log(nameString());

not work but a simple elegant

console.log(nameString("David");

does???

Thanks for all advice. :smile:


#2

A couple o' mo' thoughts: I suppose technically the function is called, within console.log -- so my question really is, why does the program mess up when the function is "explicitly" called (getting its own line, so to speak), as with all the lessons before??

And another thing: I think Instruction 04 in 11/13 would be more helpful stating something along the lines of "Call nameString() from within console.log(), as a parameter" -- though this still wouldn't have explained the above concern, which is the main puzzle...why does the browser's JS interpreter take

nameString("David");
console.log(nameString());

to mean that I wish to display the type of "programming element" (for lack of a better term; if anyone knows the correct terminology here, please share!) that nameString is when in other lessons, a simple

functionName(parameter);

is understood correctly???