6 ms·
This is probably a good opportunity to have a heated discussion over parseInt() vs Number() since parseInt('Infinity') yields NaN. I know people prefer Number(
by exevp 5y ago
This is probably a good opportunity to have a heated discussion over parseInt() vs Number() since parseInt('Infinity') yields NaN.
I know people prefer Number() for reasons but in this case it reveals the weakness of using basically a typecast with implicit language semantics for interpreting string inputs.
- goldenkey 5y agoparseFloat('Infinity'), JSON.parse('1e1024'), or parseFloat('1e1024') work just fine ;-)