In this article I want to explain in JavaScript 2015 Nike Free 5.0 this, hope this will help you understand the working mechanism. As a JavaScript programmer, learning this development for your great Nike 6.0 Trainers help, we can say more good than harm. Inspiration for this article comes from my recent Air Max Nike 6.0 Mavrk Mid 2 Skate Shoes Blue Grey 2012 Womens Navy Blue White work - completing the last chapter of Black Green Women Air Cushion Jordan High Heels Sale my book - 'JavaScript application design | JavaScript Air Max 2012 Womens Navy Blue White Application Design' (Note: You can now purchase the earlier version), I wrote about the scope aspect works. Plausible, this may be what you feel about this: the very crazy, is not it? In this essay, I want to uncover the mystery of it. this works if a function is invoked as a method of an object, then this will be assigned to this object. var parent = {method: function () {console.log (this);}}; parent.method (); // \u0026 lt; - parent Note Air Max 2012 Womens Navy Blue White that this behavior is very 'fragile', if you get a reference to a method and call , then this value will not be the parent, but to the global window object. This makes most developers confused. var parentless = parent.method; parentless (); // \u0026 lt; - Window bottom line is that you BHM PE Black History Month Nike Lunar Hyperdunk Low Online should view the call chain, in order to understand the called function is a property of Black Red Women Air Jordan 6 VI High Heels Sale an object or its own. If it is a property called, then this value will become the property of the object, otherwise this value will be assigned to the global object or window. If strict mode, this value will be undefined. In the case of being used as a constructor, when using the new keyword, this will be assigned Air Jordan Outlet to an instance object is created. function ThisClownCar () {console.log (this);} new ThisClownCar (); // \u0026 lt; Jordan CP3 VI - ThisClownCar {} Note that in this case there is no way to identify whether or not a function should be used as a constructor, thus omitting new Keyword cause this result will be a global object, as we saw above with no examples of parent calls. ThisClownCar (); // \u0026 lt; - Black Grey Pink Nike Hyperdunk 2013 Outlet Window changes this.call, .apply and .bind methods for manipulating calling functions way, to help us define this value and the value of the parameters passed to the function. Function.prototype.call can have any number of parameters, Nike Air Max the first parameter is assigned to this, the rest is passed to the calling function. Array.prototype.slice.call ([1, 2, 3], 1, 2) // \u0026 lt; - [2] Function.prototype.apply behavior and .call similar, but the parameters passed to the function is an array rather than an arbitrary parameter. String.prototype.split.apply ('13 .12.02 ', ['. ']) // \u0026 Lt; - [' 13 ',' 12 ',' 02 '] Function.prototype.bind create a special function, the function will always be passed to the .bind the argument as the value of this, and the ability to assign some parameters to create the original function of Ke Lane (curride) version. var arr = [1, 2]; var add = Array.prototype.push.bind (arr, 3); // effectively the same as arr.push (3) add (); // effectively the same as arr.push (3, 4) add (4); console.log (arr); // \u0026 lt; - [1, 2, 3, 3, 4] of this scope chain In the example below, this will not be in scope chain remains unchanged. This is a flaw rules, and often give amateur developers to bring confusion. function scoping () {console.log (this); return function () {console.log (this);};} scoping () (); // \u0026 lt; - Window // \u0026 lt; - Window there is a common method Create a local variable maintain this reference variable and can not have the same fate in the child scope. Sub-scope variables of the same name will override the parent scope Nike Dunk Heels of this reference. function retaining () {var self = this; return function () {console.log (self);};} retaining () (); // \u0026 lt; - Window unless you really want to use the parent scope of this, and this current value, because some inexplicable reason, I prefer is the method used .bind function. This can be used to assign the parent scope of this sub-scope. function bound () {return function () {console.log (this);} .bind (this);} bound () (); // \u0026 lt; - Window other questions? Do you have any questions about this for? How about this? If you think Air Max 2012 Purple Black I missed any other boundary conditions, or elegant solution, please let me know if you enjoyed this article, be sure to check out my upcoming book 'JavaScript Application Design | JavaScript Application Design', you can Access to buy the earlier version of the link.decryption of this JavaScript