Ad
  • Default User Avatar
  • Custom User Avatar

    I think this is a more realistic approach since getting what is false first would reduce nesting.

  • Custom User Avatar

    You are given an integer as a parameter input, not a string. Strings have a 'replace' prototype but integers don't. Therefore when you try to access the 'replace' prototype, you recieve an error because it doesn't exist. Cast the integer to a string. Also, make sure you return an integer instead of a string as well.

  • Custom User Avatar

    Codewars bug. Just click the "Unlock solutions" button since you would've already been rewarded honor and language ranking xp. It shouldn't change anything.

  • Custom User Avatar

    str[i] = str[i]*str[i]; looks incorrect as well. You are squaring a character with ASCII values between 48 and 58. Since 48 * 48 > 255, the answer placed into that character spot in the string would be unusable. Likewise, changing the characters to their integer value wouldn't be sufficient since the square of numbers greater then 3 would need two characters to be correctly represented in the string.

  • Custom User Avatar

    Why does my solution not show up after I submit it? And when I view solution it says I did not complete the challenge when clearly I solved this problem.