What is the difference between parseInt(string) and Number(string) in JavaScript? [duplicate]

parseInt(“123qwe”) returns 123 Number(“123qwe”) returns NaN In other words parseInt() parses up to the first non-digit and returns whatever it had parsed. Number() wants to convert the entire string into a number, which can also be a float BTW. EDIT #1: Lucero commented about the radix that can be used along with parseInt(). As far … Read more