3-5编程练习

来源:3-11 编程练习

hy_wang

2017-12-20 22:53:58

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>数据类型之NaN</title>
</head>
<body>
    <script>
var two=null;
var one=10;
var three="我是字符串";
var four="10";
var five;
console.log(isNaN(two));
console.log(isNaN(one));
console.log(isNaN(three));
console.log(isNaN(five));
console.log(isNaN(four));
</script>
</body>
</html>
请问老师关于null为什么结果是false,他是一个空的 使用typeof(null)返回object,可是为什么他isNaN的返回是false?


写回答

1回答

好帮手慕糖

2017-12-21

你好,isNaN会先把内容转换为数字类型,null转换后为0,所以返回false。

祝学习愉快~

0

0 学习 · 36712 问题

查看课程

相似问题

5-3练习

回答 4

5-4 编程练习

回答 2

3-5 编程练习

回答 1

5-2编程练习

回答 1

3-4编程练习

回答 1