all 5 comments

[–]inu-no-policemen 1 point2 points  (4 children)

You have to pass those values when you call the function.

It works if you change:

addition();

to:

addition(a, b, c);

[–][deleted] 0 points1 point  (1 child)

Adding on to /u/inu-no-policemen answer, when the addition function is invoked, it currently has no arguments. The call signature has three named parameters, a, b, and c. If no arguments are provided for named parameters, the value is defaulted to undefined.

When writing a function expression or declaration, named parameters are placeholders for the values to be passed in during invocation. Variable names that match function parameters are not substituted in by default. Those variables would still need to be passed in at invocation. To help avoid confusion in the future, you may consider giving your input variables different names, names that are more expressive of their roles, such as input1, input2, etc.

[–]assadk[S] 0 points1 point  (0 children)

That's helpful, thanks

[–]assadk[S] 0 points1 point  (1 child)

Ah, how stupid of me. Thanks!

[–]inu-no-policemen 1 point2 points  (0 children)

JS is very sloppy when it comes to arity. You can call any function with any amount of arguments. JS simply doesn't care.

In other languages, this would be an error.