Hi. The initial solution shows uses an array function, but you are free to define the function anyway you like. For exxample, all of the following declarations of arr are equivalent for the purposes of this kata:
const arr = N => [ /* the numbers 0 to N-1 */ ];
const arr = function(N) { return [ /* the numbers 0 to N-1 */ ]; }
function arr(N) { return [ /* the numbers 0 to N-1 */ ]; }
You can use whichever of the above styles you feel most comfortable with.
To clear up the confusion about the return, in an arrow function (or lambda), the return is just whatever follows the arrow. So in the example solution, the return is a blank array []. Here are some more examples:
Thanks for the feedback :) Do you think it worth setting the 6th level instead of 7th?
This comment is hidden because it contains spoiler information about the solution
This kata is tagged as
puzzles
. Puzzle kata are somewhat allowed to be underspecified.This comment is hidden because it contains spoiler information about the solution
See below.
Ah yes I see what you mean. That's a fairly common test case. Don't forget you can always perform some debugging by logging the input:
If you're ever not sure what's happening in a test, that can help!
Hi. The initial solution shows uses an array function, but you are free to define the function anyway you like. For exxample, all of the following declarations of
arr
are equivalent for the purposes of this kata:You can use whichever of the above styles you feel most comfortable with.
To clear up the confusion about the return, in an arrow function (or lambda), the return is just whatever follows the arrow. So in the example solution, the return is a blank array
[]
. Here are some more examples:I hope that stirs you in the right direction.