• js基础练习题(6)


    10.其他

    1.选择题

    var name = 'World!';
    (function () {
        if (typeof name === 'undefined') {
            var name = 'Nodeing';
            console.log('Goodbye ' + name);
        } else {
            console.log('Hello ' + name);
        }
    })();
    
    // 输出结果
    A: Goodbye Nodeing
    
    B: Hello Nodeing
    
    C: Hello undefined
    
    D: Hello World
    

    2.选择题

    ["1", "2", "3"].map(parseInt)
    
    //输出结果
    A:["1", "2", "3"]
    
    B:[1, 2, 3]
    
    C:[0, 1, 2]
    
    D:other
    

    3.选择题

    var val = 'nodeing';
    console.log('Value is ' + (val === 'noding') ? 'Something' : 'Nothing');
    
    // 输出结果
    A: Value is Something
    
    B: Value is Nothing
    
    C: NaN
    
    D: other
    

    4.选择题

    function showCase(value) {
        switch(value) {
        case 'A':
            console.log('Case A');
            break;
        case 'B':
            console.log('Case B');
            break;
        case undefined:
            console.log('undefined');
            break;
        default:
            console.log('Do not know!');
        }
    }
    showCase(new String('A'));
    
    // 选项
    A: Case A
    
    B: Case B
    
    C: Do not know!
    
    D: undefined
    

    5.选择题

    function showCase2(value) {
        switch(value) {
        case 'A':
            console.log('Case A');
            break;
        case 'B':
            console.log('Case B');
            break;
        case undefined:
            console.log('undefined');
            break;
        default:
            console.log('Do not know!');
        }
    }
    showCase(String('A'));
    
    A: Case A
    
    B: Case B
    
    C: Do not know!
    
    D: undefined
    

    6.选择题

    var a = [0];
    if ([0]) { 
      console.log(a == true);
    } else { 
      console.log("wut");
    }
    
    // 选项
    A: true
    
    B: false
    
    C: "wut"
    
    D: other
    

    7.选择题

    (function(){
      var x = y = 1;
    })();
    console.log(y);
    console.log(x);
    
    // 选项
    A: 1, 1
    
    B: error, error
    
    C: 1, error
    
    D: other
    

    8.选择题

    var a = /123/,
        b = /123/;
    a == b
    a === b
    
    A: true, true
    
    B: true, false
    
    C: false, false
    
    D: other
    

    9.选择题

    var END = Math.pow(2, 53);
    var START = END - 100;
    var count = 0;
    for (var i = START; i <= END; i++) {
        count++;
    }
    console.log(count);
    
    A: 0
    
    B: 100
    
    C: 101
    
    D: other
    

    螺钉课堂视频课程地址:http://edu.nodeing.com

  • 相关阅读:
    部署yearning1.3
    git常用指令
    U盘centos7系统安装http://www.augsky.com/599.html
    C语言与SQL SERVER数据库(转)
    C连接MySQL数据库开发之Windows环境配置及测试(转)
    vs2012中添加lib,.h文件方法(原)
    如何用Visual Studio 2013 (vs2013)编写C语言程序 (转)
    Java值传递以及引用的传递、数组的传递!!
    ssh整合需要那些jar
    类加载器
  • 原文地址:https://www.cnblogs.com/dadifeihong/p/12028655.html
Copyright © 2020-2023  润新知