I am confused about the keyword 'this' in JavaScript
This is an example: function one() { var a = 1; two(); function two() { var b = 2; three(); function three() { var c = 3; alert(a + b + c); // 6 } } } one(); //calling the function Now when we call function one(), the result is 6 . So it's all about scope chain, all variables are resolved, now I have one question. Why do we need this " this " keyword when all variables are getting resolved through scope chain? So if we have the following function: function a() { var a = 'function a'; function b() { var b = 'function b'; alert (a); //will be function a, without keyword this alert (this.a); //