As its name implies, parseInt() parses a string value and returns an integer. Syntax:- parseInt(string, radix)
- If the string begins with "0x", the radix is 16 (hexadecimal)
- If the string begins with "0", the radix is 8 (octal). This feature is deprecated
- If the string begins with any other value, the radix is 10 (decimal)
parseFloat() returns the real (decimal or floating point) value of the number parsed from a string value. If the first character in the string is a number, it parses the string until it reaches the end of the number, and returns the number as a number, not as a string.
You should also take a look at the Number() function.
"We have to remember that horses are only human ...." - Racing commentator
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.