so: -1 - 1 Number("-1") Number("- 1") parseInt("-1") parseInt("- 1") each set handled by different rules, thus diff outcomes
@YDKJS But your example illustrates the same outcome! `"-1"` → `-1`, `"- 1"` → `NaN` for both `Number` and `parseInt`.
-
-
@mathias i would have expected parseInt to just progressively invoke the NumericStringLiteral grammar on its input. nope. - 1 more reply
New conversation -
-
-
@mathias that is true. but not the same rule set. that was what i learned. there are other cases where parseInt and Number divergeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.