#11 fynctions recap


#1


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.


#2

If you do:

console.log("name");

Then you'll get an output of:

name

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.


#3

lol,

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.


#4

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