美文网首页
js基础练习题(5)

js基础练习题(5)

作者: 螺钉课堂 | 来源:发表于2019-12-18 10:08 被阅读0次

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

相关文章

  • js基础练习题(5)

    10.其他1.选择题 2.选择题 3.选择题 4.选择题 5.选择题 6.选择题 7.选择题 8.选择题 9.选择题

  • js基础阶段练习题

    编写一个函数,实现数组去重 要求不能使用系统方法 编写一个函数, 判断一个数是不是质数(素数) 方案1: 方案2:...

  • js基础练习题(1)

    1.字符串 视频教程地址: js基础练习题 1.如何连接两个或者两个以上字符串? 问:如何把变量html里面的cl...

  • js基础练习题(4)

    9.对象阅读代码,回答问题 1.下列代码输出结果 2.下列代码输出结果 3.下列代码输出结果 4.下列代码输出结果...

  • js基础练习题(2)

    5.函数 1.按要求封装两个函数 2.封装一个函数,求参数的和,注意:参数不固定 3.有下列代码 修改代码,给a,...

  • js基础练习题(3)

    8.this1.举例说说apply方法和call方法的作用和区别 2.读下面代码,写程序结果 3.读下面代码,写程...

  • 视图与子查询

    《SQL基础教程第2版》Chap.5练习题 5-2 向视图 ViewPractice5_1 插入数据. ❓为什么S...

  • js基础5(this)

    1、this的认识 1. 默认绑定 全局环境中this默认绑定到window顶层对象 自执行函数this,也就是函...

  • JS基础5

    JSON JSON格式 它是一种用于数据交换的文本格式,用来取代之前的XML。JOSN对象:它有两个静态对象 JS...

  • JS基础(5)

    1、定时器 开定时器:setInterval(函数名,时间); 每隔一段时间执行一次函数,会连续不断执行过多长时间...

网友评论

      本文标题:js基础练习题(5)

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