📜  typescript 检查字符串是否为数字 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:34.383000             🧑  作者: Mango

代码示例1
let numberToCheck: string = "40";

if(!isNaN(Number(numberToCheck))) {
    console.log("string is a number")
}
else {
    console.log("string is NOT a number")
}