The parseInt()
function parses the passed value (converting it to a string first if needed) and returns an integer number.
parseInt("400")
let number = "1203.234234";
console.log(5 + parseInt(number)); // Prints: 1208
The parseInt()
function parses the given parameter into an integer number. It also converts strings to numbers if possible, while ignoring whitespace.