Table of contents Home page
Execute this code
// Parsing stops when a character is encountered that cannot be interpreted as a valid part of a number // so, the part after "5.5" will be ignored. var n = "5.3 m" alert("5.3 m × 5 = " + 5 * parseFloat(n) + " m.") // The string can in no way be interpreted as a valid number, so this time the method returns NaN. n = "five point three metres" alert(parseFloat(n))