An amazing JavaScript syntax feature-Basic Knowledge-js tutorial

Source: Internet
Author: User
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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.