I’ve seen a few examples of this lately, and am rather curious why it happens.
( For example in the extjs source code, its all over the place )
var me=this;
or
var that=this;
And instead of referring to this, me is used.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is usually done in case of a closure which need to access “this” when the closure was created.
For ex:
In the above example the init function in obj attaches an event handler to some txt element click event. This event handler needs to access the name property of obj object. Now inside the event handler the “this” will point to some other object (element on which event happens) and not to obj object. Hence we create a variable called me this points to this (obj) and this me is used inside the event handler to refer to obj.