← BYTES
JavaScript·Starter·Ref: 3.1.15

What does `parseInt("42px")` return?

Have a question about this video? Mention reference 3.1.15 when you contact us.

a.NaN
b.42
c."42"
d.Throws a SyntaxError
`parseInt()` parses leading numeric characters from a string and stops at the first non-numeric character, returning the number it was able to parse so far (42) rather than failing outright on the trailing "px".

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES3115#JavaScript