Because:
- parseInt(n) as name suggests, parses and doesn't simply convert.
Caveats:
- For later two, the string should only represent a number otherwise it will return NaN.
- However, parseInt("10 apples") can still parse string that starts with a number.
Top comments (0)