Why:
parseInt(-0, 10) // 0
parseInt('-0', 10) // -0
Is there a sensible reason that parseInt wouldn't do -0 for both or is this just an oddity of javascript?
parseInt() works on strings. Running parseInt() on a number causes it to be cast to a string.
(-0).toString() is 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With