ParseInt and parseFloat
Convert to numbers (extract to numbers) -parseint - parseFloat console.log(parseInt('1')) // 1
console.log(Number('10px'-parseint retrievals from left to right if it encounters a character that is not a number stop retrievals to a number return console.log(parseInt()'10px')) // 10
console.log(parseInt('a10px')) // NaN
console.log(parseInt('11a10px')) // 11
console.log(parseInt('11111a10px')) // 11111
console.log(parseInt(' ')) // NaN
console.log(parseInt('2019')) // 2019
console.log(parseInt([])) // NaN
console.log(parseInt([100])) // [100] => '100' => 100
console.log(parseInt(true)) // NaN
console.log(parseInt(falseConsole. log(parseInt(parseInt())) // Nan-parseint does not support decimals.'1.5')) // 1
console.log(parseInt('1.5')) // -1
console.log(parseInt('0.5')) // 0 console.log(parseInt(100.50)) // 100 2. ParseFloat (float) identify the decimal point console.log(parseFloat(100.50)) Convert other types to numbers key + Number() + parseInt() supports base conversion (decimal binary hexadecimal octal) + parseFloat() isNaN() to determine whether a Number is a valid Number or nottrue) is a significant numberfalseThe Number type contains a significant Number and a NaNCopy the code