美文网首页
JS的这些小程序你都会了吗

JS的这些小程序你都会了吗

作者: 倚剑闯天涯_ | 来源:发表于2019-10-31 09:54 被阅读0次

    1)  var a;

    var b = a * 0;

    if (b == b) {

              console.log(b * 2 + "2" - 0 + 4);

    } else {

              console.log(!b * 2 + "2" - 0 + 4);

    }

    答案:26

    2) <script>

            var a = 1;

    </script>

    <script>

    var a;

    var b = a * 0;

    if (b == b) {

            console.log(b * 2 + "2" - 0 + 4);

    } else {

            console.log(!b * 2 + "2" - 0 + 4);

    }

    </script>

    答案:6

    3)  var t = 10;

    function test(t){

           var t = t++;

    }test(t);

    console.log(t);

    答案:10

    4) var t = 10;

    function test(test){

          var t = test++;

    }test(t);

    console.log(t);

    答案:10

    6) var t = 10;

    function test(test){

           t = test++;

    }test(t);

    console.log(t);

    答案:10

    7) var t = 10;

    function test(test){

          t = t + test;

          console.log(t);

          var t = 3;

    }test(t);

    console.log(t);

    答案:NaN  10

    8) var a;

    var b = a / 0;

    if (b == b) {

            console.log(b * 2 + "2" - 0 + 4);

    } else {

            console.log(!b * 2 + "2" - 0 + 4);

    }

    答案:26

    9)<script>

          var a = 1;

    </script>

    <script>

        var a;

        var b = a / 0;

        if (b == b) {

            console.log(b * 2 + "2" + 4);

        } else {

            console.log(!b * 2 + "2" + 4);

        }

    </script>

    答案:Infinity24

    相关文章

      网友评论

          本文标题:JS的这些小程序你都会了吗

          本文链接:https://www.haomeiwen.com/subject/aiuzvctx.html