The Requirement of the lesson is a bit confusing

Tell us what’s happening:
Hi. When i was trying to solve the lesson/problem. I understood from the requirement that the number needs to be incremented if the value is undefined. Which made me think that an if statement should be inserted in the brackets of the parameters. (number, value )

But when i checked on the hint of the lesson/problem. I understood that the value is equal to one when its undefined. i believed that what should have been written instead of saying “it will add 1 to number if value is not specified”. I thought it will add one in the parameter area and not outside it.

just saying. Maybe some figured it out. but it took me time to solve the problem. Where finally i was forced to check the help section

Your code so far

// Only change code below this line
const increment = (number, value = 1) => number + value;
// Only change code above this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36

Challenge: Set Default Parameters for Your Functions

Link to the challenge:

I guess I can see maybe how someone could be confused, but I don’t know how else grammatically we could say it.

The default parameter kicks in when the argument is not specified (it is undefined).

Modify the function increment by adding default parameters so that it will add 1 to number if value is not specified.

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