You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I just did the lecture for working with functions in javascript and in my opinion, one of the question didn't have a fully correct answer and it was kinda misleading. I asked it in the discord server and was told to report it here. here's the question:
as you can see, it asks for for a correct way for invoking the function sum(num1, num2) and it lists sum() as the answer. but, although you can call the function without the arguments/parameteres, but because num1 and num2 does not have a default value, they'll both be undefined and the result will be NaN.
I guess that either the answer should change to something like sum(3, 7) or some default values should be added in sum() function definitions (probably zero) or entirely changing the function with a simpler one that doesn't have arguments at all.
Describe the Issue
Hi,
I just did the lecture for working with functions in javascript and in my opinion, one of the question didn't have a fully correct answer and it was kinda misleading. I asked it in the discord server and was told to report it here. here's the question:
as you can see, it asks for for a correct way for invoking the function
sum(num1, num2)and it listssum()as the answer. but, although you can call the function without the arguments/parameteres, but becausenum1andnum2does not have a default value, they'll both beundefinedand the result will beNaN.Affected Page
https://www.freecodecamp.org/learn/javascript-v9/lecture-working-with-functions/what-is-the-purpose-of-functions-and-how-do-they-work
Expected behavior
I guess that either the answer should change to something like
sum(3, 7)or some default values should be added insum()function definitions (probably zero) or entirely changing the function with a simpler one that doesn't have arguments at all.