Do you really know javascript?

Source: Internet
Author: User

First question

  

  is actually the concept of variable ascension

var A;

if (! (' A ' in window)} {

A = 1;

}

Console.log (a);

second question

  

  This is where the function declaration overrides the variable declaration, even if the function declaration is written behind the variable declaration. is overwritten, but the function expression is not overwritten.

Third question

  

The section of the variable object in the context of a function makes it clear that the active object is created at the moment of entry into the function context and is initialized by the arguments property of the function. The value of the arguments property is the arguments object:

  The arguments object is a property of the active object, and it includes the following properties:

    1. callee- A reference to the current function arguments.callee.length is the number of formal parameters you can also use the function name. length; in fact funname.length = = = Arguments.callee.length;
    2. length- True number of arguments passed
    3. The value of the Properties-indexes (integer of String type) property is the parameter value of the function, arranged from left to right in the argument list. Properties-indexes the number of internal elements is equal to arguments.length. The value of properties-indexes is shared with the actual passed in parameters.

This share actually does not really share a memory address, but 2 different memory addresses, using the JavaScript engine to ensure that 2 values are always the same, of course, there is a premise, that is, the index value is less than the number of parameters you passed in, that is, if you only pass in 2 parameters, and continue to use arguments[2] to assign values, it will be inconsistent, for example:

Question Fourth

  

According to the ECMASCRIPT262 specification, the call method takes the global object (that is, window) as the value of this if the caller of the first parameter passed in is null or undefined. So, no matter when you pass in NULL, its this is the Global object window. If it is alert (this); Is ' [Object Window] ';

Do you really know javascript?

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.