📜  isNumber javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:34.795000             🧑  作者: Mango

代码示例6
// IsInteger
if (Number.isInteger(val)) {
 // It is indeed a number
}
// isNaN (is not a number)
if (isNaN(val)) {
 // It is not a number
}
// Another option is typeof which return a string
if (typeof(val) === 'number') {
 // Guess what, it's a bloody number!
}