首页 > 编程语言 > 详细

javascript中===和==的区别

时间:2016-09-29 00:55:49      阅读:157      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!