JavaScript Note points (2)

Source: Internet
Author: User

1.prototype and __proto__

The __proto__ of all objects point to the prototype of their constructors, the prototype of constructor

2. Problem with variable scope

It is often assumed that the value of a variable cannot be found in the current scope to be searched in its parent scope, which is not accurate and should be found in the scope of creating the function.

Var b=100; Var fun1=function() {alert (b)}var obj={      B:ten,      fun:fun1}obj.fun () // The result is

3.settimeout method

The SetTimeout method delays the execution of the function when the JS engine is idle.

Var b=0; Settimeout (function(B=1;alert (1)), 0) while (!b) {}

Here will never alert 1, will enter the dead loop, if the second parameter of the settimeout is 0, even if the JS thread is idle, will not be executed immediately, the browser has a minimum time, the impression that IE is 4ms, Firefox and Google do not remember

So much for this time.

JavaScript Note points (2)

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.