This usage of javascript

Source: Internet
Author: User


1. This in the Global Code

This in the global context, its value is the global object itself, which is the window object in the browser, as shown in.

Look at the following examples:

//Global Scope
//The implicit property of the global object
varFOO1 = "ABC";
Console.log ( This. foo1 = = window.foo1); Console.log (FOO1); Console.log ( This. foo1); Console.log (WINDOW.FOO1);//true ABC ABC abc

//The implicit property of the global object
Foo2 = "Def";
Console.log ( This. Foo2 = = Window.foo2); Console.log (FOO2); Console.log ( This. Foo2); Console.log (WINDOW.FOO2);//true def def def

//The explicit property of the global object
This. Foo3 = "GH";
Console.log ( This. Foo3 = = Window.foo3); Console.log (FOO3); Console.log ( This. Foo3); Console.log (WINDOW.FOO3);//true gh gh gh

2.


This usage of 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.