3 ms·
For anyone who is wondering why: parseInt() only accepts strings as input. So JavaScript calls .toString() on the number before passing it as an argument.
by jannes 9y ago
For anyone who is wondering why:
parseInt() only accepts strings as input. So JavaScript calls .toString() on the number before passing it as an argument.
(0.000001).toString() // "0.000001"
(0.0000001).toString() // "1e-7"
By the way, TypeScript or Flow would have caught this error during compile time.