zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    AcWing 157. 树形地铁系统 (hash判断树同构)打卡
    AcWing 156. 矩阵 (哈希二维转一维查询)打卡
    AcWing 144. 最长异或值路径 01字典树打卡
    AcWing 143. 最大异或对 01字典树打卡
    AcWing 142. 前缀统计 字典树打卡
    AcWing 139. 回文子串的最大长度 hash打卡
    AcWing 138. 兔子与兔子 hash打卡
    常用C库函数功能及用法
    编程实现C库函数
    C语言面试题5
  • 原文地址:https://www.cnblogs.com/dadifeihong/p/12028655.html
Copyright © 2011-2022 走看看