parseInt() and Number() are both used to convert a string into a number.
- parseInt() parses the value of the string and converts to number till the first non-digit character.
- Number() tries to convert the type of the string to number and returns nothing if there are non-digit characters in the string.
Example:
parseInt("67dpi"); // returns 67
// Convert type
Number('67dpi'); // returns NaN