JavaScript JavaScript Basics Creating Reusable Code with Functions Review: Giving Information to Functions

What is the correct Answer.

I don't understand how this answer is incorrect.

None of the other answers seem correct. You also have another question within this same quiz that asks about "arguments" and uses the same phrasing to describe that it is a value that is passed back to the function when you call the function.

1 Answer

james south
james south
Front End Web Development Techdegree Graduate 33,246 Points

the answers are correct. they may seem the same and they are similar, but actually different. parameters are internal variables in a function body. arguments are the values you pass into a function when you call it. so if i define a function myFunc(param){return param*2} you can see param is my internal variable that i am doubling and returning. param is the parameter of the myFunc function. later on when i call myFunc, the number i pass into it is the argument, so in myFunc(4), 4 is the argument. when myFunc runs, it stores the argument 4 in the parameter param, and executes the instructions in the function body, here, doubling the argument and returning it. myFunc's parameter is always param, but i can call it all day long with all sorts of arguments, 4, 6, 2, whatever i need. each time it is called, it takes one argument and returns its double.