This points to the problem-strict, non-strict mode, event handler

Source: Internet
Author: User

The this value depends on where it is called with methods   function calls: ES3 and non-strict es5,this point to the Global object, ES5 Strict mode for undefined  method invocation: This points to the object that called it.  function IsStrict () {return!this;} Determine whether the strict mode  this value points to the special case: var name= "window";                          ,         &NB Sp    obj.getname ();        //myobjvar obj={                      and nbsp                          ,         &NB SP; (obj.getname) ();    //myobj            Name: "MYOBJ",            GETN Ame:function () {                              (o) Bj.getname=obj.getname) ();    //Window                Console.log (this.name);      & NBsp    }       };  ie event handlers, this points to global scope event handlers and IE DOM0-level methods, This points to the bound object (Currenttarget)

This points to the problem-strict, non-strict mode, event handler

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.