码迷,mamicode.com
首页 > 编程语言 > 详细

javascript中===和==的区别

时间:2016-09-29 00:57:18      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    
    <script type="text/javascript">
        // === 和 ==
        // === (判断更加严格)
        // 先会判断两边的表达式类型是否相同,如果相同再判断值
        // 如果类型不相同,直接返回 false
        // console.log(null === undefined); // false

        // == 存在数据类型的 隐式转换
        // console.log(null == undefined); // true
        // console.log(0 == "0"); // true
        // console.log(0 == ""); // true
        // console.log(123 == "123"); // true

        // 如果转换为布尔值:
        console.log(!!0);
        console.log(!!"");
    </script>
</body>
</html>

 

javascript中===和==的区别

标签:

原文地址:http://www.cnblogs.com/lsy0403/p/5918143.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!