如何检查值是否为JavaScript中的数字?
要检查JavaScript中的值是否为数字,请使用isInteger()方法。此方法检查值是否为数字。
示例
您可以尝试运行以下代码来检查值是否为数字-
<html>
<head>
<title>JavaScript isInteger() Method </title>
</head>
<body>
<script>
document.write(Number.isInteger(30));
document.write("<br>"+Number.isInteger(true));
document.write("<br>"+Number.isInteger(false));
document.write("<br>"+Number.isInteger(-30));
</script>
</body>
</html>热门推荐
10 同事们生日祝福语简短
11 广东新居入伙简短祝福语
12 单位搬迁新址祝福语简短
13 表妹结婚祝福语简短藏语
14 简短新婚铺被子祝福语
15 分手快乐祝福语简短
16 祝福语同事离职英文简短
17 孩子转学离群祝福语简短
18 写字生日祝福语简短独特