Javascript definite Guide notes

Source: Internet
Author: User

I. Javascript Core

1. Javascript type: two main types: original type and object type.

The original types include number, String, Boolean, null, and undefined. null and undefined are two special types.

    • Typeof null = object, which indicates that null can be considered as a special object value, representing no object. Generally, null is considered as a separate member of a separate type, which can be the value of numbers, strings, and object, meaning no value;
    • And typeof undefined === undefined. Undefined usually declares a variable, but does not pay the value for the variable. As a result, the variable value is undefined.

Object Type: Except for the preceding five primitive types, all objects are of the object type. Objects in JS are the set of attributes (JSON ).

 

2. Variables

Variables that are not declared using VAR are created as global variables.

4.3.1

JS does not have block-level scope. All variables declared in the function are defined in the function.

----------------------------------------------

Function Test (){

For (var k = 0; k <10; k ++ ){

Alert (k );

}

Alert (k); // 10

}

----------------------------------------------

VaR scope = "Global ";

Function f ()
{
Alert (scope); // undefined, not global
VaR scope = "local ";
Alert (scope );
}

F ();

----------------------------------------------

4.6.1

When the JS interpreter is running, a global object is created first. The attribute of the object is JSProgram.

4.6.2

JS functions run in their own execution environment. Has its own call object. The property of the called object is the local variable of the function.

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.