[Js syntax] isNaN()

Programming practice

Use the isNaN() function to check whether the data type we have learned is a numeric type!

The data to be judged are as follows:

null, 10, "I am a string", "10", undefined

task

Step 1: Define several variables in the <script></script> tag, the values ​​are: null, 10, "I am a string", "10", undefined

Step 2: Use isNaN() to determine whether they are numeric values. Be sure to note: isNaN() returns false, which means it is a value, and returns true, which means it is a non-numerical value.

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>数据类型之isNaN</title>
</head>
<body>
<script>
//补充代码
var a=null,b=10,c="我是字符串",d="10",e="undefined";
console.log (isNaN (a));
console.log (isNaN (b));
console.log (isNaN (c));
console.log (isNaN (d));
console.log (isNaN (e));
</script>
</body>
</html>

result

 

Guess you like

Origin blog.csdn.net/qq_39799094/article/details/108975523