What is logged?
console.log(parseInt('08'), parseInt('0x1f'), parseInt('12px'));
- 8 31 12
- 8 0 NaN
- 0 31 12
- 8 31 NaN
parseInt reads a 0x prefix as hex and stops at the first character it cannot use.
Play Problem Solving ▸
console.log(parseInt('08'), parseInt('0x1f'), parseInt('12px'));