Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
one thing to watch out for - the ?? won't catch index out of range errors (I also tried this first thinking it would)
Interesting solution but doesn't preserve types (for example the bool
false
would become a string"false"
. It would not work as expected with the example in the kata description.beautiful
The performance difference is negligible between the two
Clever solution but definitely not "Best Practices"
This comment is hidden because it contains spoiler information about the solution
It will return false since n will be less than 0 in the first iteration
Fixed
Should either take out the sentence "Remember that there can't be more than 3 identical symbols in a row." or take out examples that go over 3999. Would be helpful to mention how to handle nums over 3999 in description since actual roman numeral systems to express larger numbers do not just spam M until the desired number is reached.
The Array function is used to create a new array. It is capitalized because it is the standard for constructor functions to be capitalized.
Array(2) creates an array of 2 blank values.
In this case it is being used to create an empty array and join the array together using whichever character is being iterated over in the loop. Since there are no contents in the array, using this with the join() function works like a multiplier for the character being passed into join. For example Array(3).join("x") would evaluate to xx. You need one more item in the array since join() adds characters between array objects, so three empty arrays would be seperated by 2 join characters.