JavaScript has many differences from the programming habits of C, Java, and so on, which may lead to many unexpected things. Today, we will discuss some javascript-related questions posted by zhihu about these tough syntax features, although it was a long time ago, these questions are quite classic, and javascript is really a tough language.
1.
The Code is as follows:
(Function (){
Return typeof arguments;
})();
A. "object"
B. "array"
C. "arguments"
D. "undefined"
Answer:
2.
The Code is as follows:
Var f = function g (){
Return 23;
};
Typeof g ();
A. "number"
B. "undefined"
C. "function"
D. Eorror
Answer: D
3.
The Code is as follows:
(Function (x ){
Delete x;
Return x;
}) (1 );
A. 1
B. null
C. undefined
D. Error
Answer:
4.
The Code is as follows:
Var y = 1,
X = y = typeof x;
X;
A. 1
B. "number"
C. undefined
D. "undefined"
Answer: D
5.
The Code is as follows:
(Function f (f ){
Return typeof f ();
}) (Function (){
Return 1;
});
A. "number"
B. "undefined"
C. "function"
D. Error
Answer:
6.
The Code is as follows:
Var foo = {
Bar: function (){
Return this. baz;
},
Baz: 1
};
(Function (){
Return typeof arguments [0] ();
}) (Foo. bar );
A. "undefined"
B. "object"
C. "number"
D. "function"
Answer:
7.
The Code is as follows:
Var foo = {
Bar: function (){
Return this. baz;
},
Baz: 1
};
Typeof (f = foo. bar )();
A. "undefined"
B. "object"
C. "number"
D. "function"
Answer:
8.
The Code is as follows:
Var f = (function f (){
Return "1 ";
}, Function g (){
Return 2;
})();
Typeof f;
A. "string"
B. "number"
C. "function"
D. "undefined"
Answer: B
9.
The Code is as follows:
Var x = 1;
If (function f (){}){
X + = typeof f;
}
X;
A. 1
B. "1 function"
C. "1 undefined"
D. NaN
Answer: C
10.
The Code is as follows:
Var x = [typeof x, typeof y] [1];
Typeof x;
A. "number"
B. "string"
C. "undefined"
D. "object"
Answer: B
11.
The Code is as follows:
(Function (foo ){
Return typeof foo. bar;
})({
Foo :{
Bar: 1
}
});
A. "undefined"
B. "object"
C. "number"
D. Error
Answer:
12.
The Code is as follows:
(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
Answer: B
13.
The Code is as follows:
Function f (){
Return f;
}
New f () instanceof f;
A, true
B. false
Answer: B
14.
The Code is as follows:
With (function (x, undefined) {}) length;
A, 1
B, 2
C. undefined
D. Error
Answer: B
15.
The Code is as follows:
Which of the following statements produces a running error :()
A. var obj = ();
B. var obj = [];
C. var obj = {};
D. var obj = //;
Answer: