30 javascript questions and answers that you "cannot do all" (1)
1. The running result of the following expression is:
["1", "2", "3"]. map (parseInt)
A. ["1", "2", "3"]
B. [1, 2, 3]
C. [0, 1, 2]
D. Miscellaneous
2. The running result of the following expression is:
[Typeof null, null instanceof Object]
A. ["object", false]
B. [null, false]
C. ["object", true]
D. Miscellaneous
3. The running result of the following expression is:
[[3, 2, 1]. reduce (Math. pow), []. reduce (Math. pow)]
A. Error
B. [9, 0]
C. [9, NaN]
D. [9, undefined]
4. The running result of the following expression is:
Var val = 'value ';
Console.info ('value id' + (val = 'value ')? 'Something': 'Nothing ');
A. Something
B. Nothing
C. NaN
D. Miscellaneous
5. The running result of the following expression is:
Var name = 'World ';
(Function (){
If (typeof name = 'undefined '){
Var name = "Jack ";
Console.info ('Goodbye '+ name );
} Else {
Console.info ('hello' + name );
}
})();
A. Goodbye Jack
B. Hello Jack
C. Goodbye undefined
D. Hello undefined
6. The running result of the following expression is:
Var START = END-100;
Var count = 0;
For (var I = START; I <= END; I ++ ){
Count ++;
}
Lele.info (count );
A.0
B .100
C.101
D. Miscellaneous
7. The running result of the following expression is:
Var arr = [0, 1, 2];
Arr [10] = 10;
Arr. filter (function (x) {return x = undefined });
A. [undefined x 7]
B. [0, 1, 2, 10]
C. []
D. [undefined]
8. The running result of the following expression is:
Var two = 0.2;
Var one = 0.1;
Var eight = 0.8;
Var six= 0.6;
[Two-one = one, eight-six = two];
A. [true, true]
B. [false, false]
C. [true, false]
D. Miscellaneous
9. The running result of the following expression is:
Function showCase (value ){
Switch (value ){
Case 'A ':
Console.info ('case ');
Break;
Case 'B ':
Console.info ('case B ');
Break;
Case undefined:
Console.info ('undefined ');
Break;
Default:
Console.info ('Do not know! ');
}
}
ShowCase (new String ('A '));
A. Case
B. Case B
C. Do not know
D. undefined
10. The running result of the following expression is:
Function showCase (value ){
Switch (value ){
Case 'A ':
Console.info ('case ');
Break;
Case 'B ':
Console.info ('case B ');
Break;
Case undefined:
Console.info ('undefined ');
Break;
Default:
Console.info ('Do not know! ');
}
}
ShowCase (String ('A '));
A. Case
B. Case B
C. Do not know
D. undefined
11. The running result of the following expression is:
Function isOdd (num ){
Return num % 2 = 1;
}
Function isEven (num ){
Return num % 2 = 0;
}
Function isSane (num ){
Return isEven (num) | isOdd (num );
}
Var values = [7, 4, '13',-9, Infinity];
Values. map (isSane );
A. [true, true]
B. [true, true, false]
C. [true, false, false]
D. [true, true, false]
12. The running result of the following expression is:
[ParseInt (3,8), parseInt (3,2), parseInt (3,0)]
A. [3, 3]
B. [3, 3, NaN]
C. [3, NaN, NaN]
D. Miscellaneous
13. The running result of the following expression is:
Array. isArray (Array. prototype)
A. true
B. false
C. Error
D. Miscellaneous
14. The running result of the following expression is:
Var a = [0];
If ([0]) {
Console.info (a = true );
} Else {
Console.info ("else ");
}
A. true
B. false
C. "else"
D. Miscellaneous
15. The running result of the following expression is:
[] = []
A. true
B. false
C. Error
D. Miscellaneous