Ad
  • Custom User Avatar

    What I want is to slice the number off the front of the string so I need to know the length of the number. Adding an empty string to a number converts the number to a string. So (4 + "").length = 1, (13 + "").length = 2, and so on. A number by itself doesn't have a length property.

  • Custom User Avatar

    You're right, the problem only specifies "letters," which is open to interpretation. My solution passes all tests, so perhaps the author did not have foreign letters in mind.

  • Custom User Avatar

    hi! I think this is a very smart solution and I figured this is the one I can understand and internalize. Except for one thing: I see that in the first line where youre slicing the message (message = message.slice((num + "").length) ) you are adding a an empty string to the num character. I see that tests fail without this operation. I was wondering how this is affecting the way the string is sliced? e.g. string.slice should take two parameters, both of them numbers, so what does this empty string change? Thanks in advance.