#11 fynctions recap


I am not stuck, I got the correct code. I am confused by the "Why". It seems a lot of coding to come up with a name for the console log. In the var I have nameString and name; in return I have name again; I call using nameString again specifying ("Yolanda"); in console.log I repeat nameString AND Yolanda. I am a beginner, and do not understand how this is simpler than just typing the name each time since I have to tell the console .log the name each time. Why doesn't the console log print the name if I put ("name") in the console.log?

Replace this line with your code.


If you do:


Then you'll get an output of:


As that is the value that you gave to console.log to display to the console.

I'm not quite sure what it is you're asking, or what code you are referring to.



you're very correct, its easy to just type console.log() <---- and put your name inside and yes, it will work.
but that is not the purpose of the lesson.
The purpose of the lesson is to give you a foundation on "How to use functions in programming" They just want you to understand functions and how to insert variables(arguments) within the parameters and return its value. You'll find this rudimentary exercises useful when you start learning more complex functions.

Hope this was helpful.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.