I’m unsure how to write the solution code so it expands/closes but here’s another solution I think would be valid based on the examples in the original problem:
@Sky020 For the example you added it seems a bit odd to have the add function as a function declaration with an arrow function inside it. Why not just make it an arrow function?
We can add parentheses to the parameters if that makes it clearer (e.g. prettier does this).
const add = (x) => (y) => (z) => x + y + z;
console.log(add(10)(20)(30)); // 60
Not sure if having another example that shows each function call would be useful, just to clearly show what is happening?
const add = (x) => (y) => (z) => x + y + z;
const innerFn1 = add(10);
const innerFn2 = innerFn1(20);
const result = innerFn2(30);
console.log(result); // 60
I think this would have to go in its own discussion - whether or not we change the seed. I believe the solutions in the guide posts should follow a structure, and not just be enough to pass, because there are many challenges that can be passed with code that does not even do anything (eg. when the tests use regex, then a bunch of comments can pass, but should not be considered solutions).
The reason I took this suggestion is: it acts as a solution, to challenge interested campers to see something a bit more advanced (arrow functions, for shorter code).
In general, I would hope all of the _Solution 1_s are good code, with best-practices to pass the challenges. Then, the other solutions could contain Golf-Code-type code; something different, and fun.
I think having a real-world example of how this would look using an arrow function is a lot more valuable than staying within the restrictions that are given for this challenge (i.e. the Add your code here comments).
Not even sure why the code comments are there other than maybe to avoid the camper renaming the function. There are no test restrictions other than the function name that would require the camper to not be allowed to change the function to an arrow function.
I mean the arrow function version is the solution we have in the solution code, so I don’t see why it shouldn’t be in the example solutions?