Ad
  • Default User Avatar

    .

  • Default User Avatar

    Right, yeah. Well. See if you can make it use integer math and if that works out for you.
    js number is a float, but float is able to represent integers.
    what introduces non-integers is division, so whenever you do division you have to immediately bring it back into an integer value. continuing to use the result before doing this will likely introduce rounding errors into your results

  • Default User Avatar

    If printing out the remaining time after hours and minutes, I get:

    remaining: 59.99999999999939

    So, I suppose the "advice" then is that the entire problem is solvable with integer math and that you should avoid leaning on float in ways where you can introduce rounding errors.
    Maybe that's vague for javascript where you're stuck with the float type, but I assume that integer division is still something that can be carried out correctly (?)

  • Default User Avatar

    ..I fixed the obvious bug and now have something that behaves like you originally described. hmm.

  • Default User Avatar

    I see one thing that's really really wrong and unrelated to rounding.
    Maybe you even posted a wrong version of your code? This won't be off by one second, it'll be more wrong than that.

  • Default User Avatar

    It definitely shouldn't be ambiguous because the inputs are int - the problem is solvable without ever using floats.... except in javascript which in its infinite wisdom doesn't have an integer type. Still, it's possible to do correct integer math in javascript... I think? So something's got to be wrong with what you're doing.

  • Default User Avatar

    Maybe you're truncating too early or doing something else wrong. You're supposed to floor, that's in the instructions. That's the one thing you know isn't the cause.

  • Default User Avatar

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

  • Default User Avatar

    the trouble in your solution is that if find contains special characters like (, ) , [ , ] and others, the regexp compiler is going to interpret them as a part of the regexp syntax, because you didnt escape them to signify that they are meant to match a litteral character
    This is why you're seeing a regexp compiler error, i'm guessing the character to find was something [ and opening brackets need a matching closing bracket in regexp syntax
    i hope i helped

  • Custom User Avatar

    Your solution is wrong. Please read and follow the Troubleshooting guide.

  • Custom User Avatar

    Did you change that test? It's repeated verbatim in the Submit tests, so I have a hard time believing you'd fail the Example tests if you pass the Submit tests.

  • Custom User Avatar

    Return a number, not a string.