• Custom User Avatar

    It fails when x = "1.0" and when x = "0x10"

    It fails for "1.0" because the number is a floating type number and the task requires you to only accept integers. Even though the number has no fractional part, it is still a floating point number. You need to make your code so that it only accepts integers and no floating point numbers and will return "NaN" for the floats. Description states It should make the conversion if the given string only contains a single integer value

    It fails for "0x10" because your code automatically complier the number from base 10 (decimal) to base 16 (hexadecimal). You need to make your code return "NaN" for bases other than decimal. Description states It should assume that all numbers are not signed and written in base 10

    If you're lazy, you can just make special cases for them using an if statement to filter them out :P.

  • Custom User Avatar

    Post your code down below ^^