Amazing JavaScript syntax features and javascript syntax features
I have seen some javascript-related questions published by zhihu. I 'd like to share with you that although N was a long time ago, these questions are quite classic, javascript is a tough language.
1.
Copy codeThe Code is as follows:
(Function (){
Return typeof arguments;
})();
A. "object"
B. "array"
C. "arguments"
D. "undefined"
Answer:
2.
Copy codeThe Code is as follows:
Var f = function g (){
Return 23;
};
Typeof g ();
A. "number"
B. "undefined"
C. "function"
D. Eorror
Answer: D
3.
Copy codeThe Code is as follows:
(Function (x ){
Delete x;
Return x;
}) (1 );
A. 1
B. null
C. undefined
D. Error
Answer:
4.
Copy codeThe Code is as follows:
Var y = 1,
X = y = typeof x;
X;
A. 1
B. "number"
C. undefined
D. "undefined"
Answer: D
5.
Copy codeThe Code is as follows:
(Function f (f ){
Return typeof f ();
}) (Function (){
Return 1;
});
A. "number"
B. "undefined"
C. "function"
D. Error
Answer:
6.
Copy codeThe 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.
Copy codeThe 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.
Copy codeThe 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.
Copy codeThe 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.
Copy codeThe Code is as follows:
Var x = [typeof x, typeof y] [1];
Typeof x;
A. "number"
B. "string"
C. "undefined"
D. "object"
Answer: B
11.
Copy codeThe Code is as follows:
(Function (foo ){
Return typeof foo. bar;
})({
Foo :{
Bar: 1
}
});
A. "undefined"
B. "object"
C. "number"
D. Error
Answer:
12.
Copy codeThe 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.
Copy codeThe Code is as follows:
Function f (){
Return f;
}
New f () instanceof f;
A, true
B. false
Answer: B
14.
Copy codeThe Code is as follows:
With (function (x, undefined) {}) length;
A, 1
B, 2
C. undefined
D. Error
Answer: B
15.
Copy codeThe 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:
Javascript syntax
Anonymous function execution is equivalent
Var func = function (c ){
Alert (c );
};
Func (2 );
That is, the function is defined and executed at the same time. Note that 2 is the parameter.
What are the syntax of javascript?
Basic JavaScript syntax
1. Data Types: numeric, logical, string, and undefined
2. Writing rules:
1) JavaScript is case sensitive and the statement uses semicolons as the Terminator;
2) supports/*... */and //... annotation statements.
3) The + = +-+ * =/= % = and other operators can be used in the value assignment statement.
2. constants, variables, and expressions-
This is very detailed. You can see it :)~~
Www.catvu.com/asp/JAVA/002.htm
Simplified Javascript syntax in Html
Mileden.51.net/dnly/jsp.htm
Introduction to JavaScript Syntax :)~~
Www.dali.tcc.edu.tw/../2.htm