js引用类型和基本类型、隐式类型转换以及强制类型转换面试题

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>js引用类型和基本类型、隐式类型转换以及强制类型转换面试题</title>
    <style>
        body{margin:0;padding:0;}
    </style>
</head>
<body>
<script type="text/javascript">
    "use strict";
    var a = 1;
    var b = {};
    function show(x, y) {
        x = 2;
        y.num = 3;
    }
    show(a, b);

    console.log(a,b);  //1 {num:3}

    if (null == undefined) {
        console.log("1")
    } else {
        console.log("2")
    }  //1

    console.log(Number(undefined))  //NaN
    console.log(Number(null))       //0
</script>
 
</body>
</html>
备注:欢迎加入web前端求职招聘qq群:668352707
posted @ 2018-03-08 14:21  徐同保  阅读(159)  评论(0编辑  收藏  举报