JavaScript Interview Notes

Source: Internet
Author: User

Richinfo:

1, under what circumstances will appear undefined value, and the program will not error!
Recommendation: 1, the variable is defined, but not assigned to the case, 2, access to the object's properties, but the property does not have time, 3, access to the array when the index does not exist, 4, access to the function defined parameters, but the parameters are not passed in, 5, the function does not show the write return, or return undefined when no value is written back.


The difference between 2,call and apply
Suggestion: Very boring question, is the difference of parameters, the second parameter of apply must be an array or an array of classes, many times will use the other function of the arguments object as its second parameter


3, how do I use a For loop to bind events to 3 buttons? How many closures will be created?
Suggestion: Consider this scenario yourself, and in the third edition of the Advanced JavaScript tutorial there is an almost identical example, which can be consulted.
The main test is the application of closures: the external function of the variable I, in the process of the For loop will continue to grow, for the end of the for loop, the value becomes 3, if the direct binding, will cause all the event handler function to use the value is 3, the better way is to use a self-executing a closure function, I can be passed in as a parameter.
for (var i = 0; i < 3; i++) {
Btns[i].onclick = (function (innerindex) {
return function () {
Using Innerindex here, the value of this innerindex will be equal to the I value of the For loop execution here.
}
}) (i);
}
How many loops are created here, and the number of closures that you create.


4, is the scope of the closure created at the time of definition, or created at the time of execution?
Suggestion: This question I remember is not very clear, probably he wants you to say that the scope of the closure is always defined as the scope of the external function, and the inner function where the execution is irrelevant. When you define it, you create it!


5, why is the attribute in Object.prototype not traversed through a for-in loop?
Recommendation: This involves the property category of the object, some are read-only, some are write-only, and some


6, how do you make sure that you do not traverse the properties of the prototype when using the For In loop object?
Recommendation: Use the hasOwnProperty method to determine


7,json formatted data, what is the case error prone?
Suggestion: This question I did not answer out, just checked the information, should be the problem of anti-slash, refer to this information: http://www.cnblogs.com/lengyuhong/archive/2012/01/07/2262390.html


8, how is the grouping of regular expressions done? Does JS support grouping naming of regular expressions? What does the i,g,m of regular expressions mean?
Recommendation: Group the left parenthesis in the order in which they appear. JS does not support grouping naming. I is ignoring case, G is global match, M is multi-line match.

How much does 9,nodejs know?

10, browser caching mechanism


11,cookie

Jd:

1, if the dynamic loading of the picture is implemented?

2, introduce the technical framework used in the recent project

3,

JavaScript Interview Notes

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.