Without an explicit radix, parseInt treats a leading "0x" as hexadecimal (so "0x10" is 16) but a plain leading zero as decimal in modern engines (so "08" is 8, not octal). It also parses as many leading numeric characters as it can and ignores the rest, so "10px" yields 10. Always pass a radix, e.g. parseInt(str, 10), to avoid surprises.