Ad
  • Custom User Avatar

    one thing to watch out for - the ?? won't catch index out of range errors (I also tried this first thinking it would)

  • Custom User Avatar

    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.

  • Custom User Avatar

    The performance difference is negligible between the two

  • Custom User Avatar

    Clever solution but definitely not "Best Practices"

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    It will return false since n will be less than 0 in the first iteration

  • Custom User Avatar

    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.

  • Default User Avatar

    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.