今日的JavaScript已经突飞猛进,但JS的许多特性仍然保留,以下题目并不是有意设坑,许多地方将验证你的JS底细,如果错了一半,请别告诉我你从事前端。
第1题
(function(){
return typeof arguments;
})();
A: "object"
B: "array"
C:"arguments"
D:"undefined"
第2题
var f = function g(){
return 23;
};
typeof g();
A: "number"
B:"undefined"
C: "function"
D:Error
第3题
(function(x){
delete x;
return x;
})(1);
A:1
B: null
C: undefined
D: Error
第4题
var y = 1, x = y = typeof x; x;
A:1
B: "number"
C:undefined
D:"undefined"
第5题
(function f(f){
return typeof f();
})(function(){ return 1; });
A: "number"
B:"undefined"
C:"function"
D:Error
第6题
var foo = {
bar: function() {
return this.baz;
},
baz: 1
};
(function(){
return typeof arguments[0]();
})(foo.bar);
A:"undefined"
B:"object"
C:"number"
D:"function"
第7题
var foo = {
bar: function(){
return this.baz;
},
baz: 1
}
typeof (f = foo.bar)();
A:"undefined"
B:"object"
C:"number"
D:"function"
第8题
var f = (
function f(){
return "1";
},
function g(){
return 2;
}
)();
typeof f;
A:"string"
B:"number"
C:"undefined"
D:"function"
第9题
var x = 1;
if (function f(){}) {
x += typeof f;
}
x;
A:1
B: "1function"
C:"1undefined"
D:NaN
第10题
var x = [typeof x, typeof y][1]; typeof typeof x;
A:"number"
B: "string"
C: "undefined"
D: "object"
第11题
(function(foo){
return typeof foo.bar;
})({ foo: { bar: 1 } });
A:"undefined"
B: "object"
C: "number"
D:Error
第12题
(function f(){
function f(){ return 1; }
return f();
function f(){ return 2; }
})();
A:1
B:2
C: Error (e.g. "Too much recursion")
D: undefined
第13题
function f(){ return f; }
new f() instanceof f;
A:true
B:false
第14题
with (function(x, undefined){}) length;
A:1
B:2
C:undefined
D: Error
全部答案在下方
。
。
。
。
A D A D A
A A B C B
A B B B






网友评论文明上网理性发言 已有0人参与
发表评论: