Difference between parseInt(string) and Number(string) in JavaScript?

By | July 14, 2017

parseInt() parses up to the first non-digit and returns whatever it had parsed.
Number() wants to convert the entire string into a number

Example:

parseInt(“123xyz”)      //It will returns 123

Number(“123xyz”)      //It will returns NaN

Like it? Share it