Arguments Optional - argument syntax problem

It appears that many people have solved this but I cannot find an explanation about the argument syntax problem. One of the test cases has two sets of parentheses: addTogether(2)(3) which should add up to five. Unfortunately, it’s unclear how to get the function to process the arguments in the same fashion as this: addTogether(2, 3). Help…!

It is best to provide a link to the challenge your are working one.

In this challenge, if you receive two arguments, then you should return a number but if you receive only one argument, then you should return a function.

Jeremy is correct. If addTogether(2) returns a function, then that function will immediately be called with 3 as the argument.

2 Likes

So the return function accepts the second argument (second set of parentheses) and then performs the addition in lieu of having both arguments provided inside the first set of parentheses. Thank you!

1 Like

You got it :slight_smile: Happy coding!

1 Like

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