3 ms·
That’s a terrible idea: parseInt(0.000001) // 0 parseInt(0.0000001) // 1
by tobr 9y ago
That’s a terrible idea:
parseInt(0.000001) // 0
parseInt(0.0000001) // 1
- jannes 9y agoFor 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.