They work fine, your problem is somewhere else.
You have to put it like string.Join(''), as in some other methods you have to write System.X instead of X. Annoying and common on codewars.
For JS I think there's 500 random tests. With basic approach I'm passing in ~1.5s. You can always add console.log(n) at top of your function.
Either you got an infinite loop, or your code is really slow. Whatever the case, that's not a kata issue.
if(num <= 0) return "";
String is not an Array in JavaScript, they're entirely different datatypes.
String
Array
You've to return an array, and you're not doing that.
Loading collection data...
They work fine, your problem is somewhere else.
You have to put it like string.Join(''), as in some other methods you have to write System.X instead of X. Annoying and common on codewars.
For JS I think there's 500 random tests. With basic approach I'm passing in ~1.5s. You can always add console.log(n) at top of your function.
Either you got an infinite loop, or your code is really slow. Whatever the case, that's not a kata issue.
String
is not anArray
in JavaScript, they're entirely different datatypes.You've to return an array, and you're not doing that.