Please mark your post as having spoiler content next time, read this: https://docs.codewars.com/training/troubleshooting/#post-discourse
The difference is the first code won't reach array[array.length] that's undefined because it'll return earlier. Also the second won't work for other reasons, but that's the main difference.
array[array.length]
undefined
This comment is hidden because it contains spoiler information about the solution
Why are you returning an array?
The at() function is in Node versions 16.6.0 and above, which codewars doesn't have
my code returns the right numbers, but the codewars platform is saying at() is not a function
what gives?
Loading collection data...
Please mark your post as having spoiler content next time, read this: https://docs.codewars.com/training/troubleshooting/#post-discourse
The difference is the first code won't reach
array[array.length]
that'sundefined
because it'll return earlier. Also the second won't work for other reasons, but that's the main difference.This comment is hidden because it contains spoiler information about the solution
Why are you returning an array?
The at() function is in Node versions 16.6.0 and above, which codewars doesn't have
my code returns the right numbers, but the codewars platform is saying at() is not a function
what gives?