Welcome file this keyword is used to point at the current object in the code. For instance: If the code is presently at an object created by the help of the ‘new’ keyword, then ‘this’ keyword will point to the object being created. It has different values depending on where it is used: In a method, this refers to the owner object . Alone, this refers to the global object . In strict mode this refer to the global object . In a function, this refers to the global object . In a function, in strict mode, this is undefined . In an object method , this refers to the current object. In the example, this refers to the employee object. this Alone when this keyword is used alone, not written inside a function or object then it will refer to global object. & In browser window global object will be [object window] In a browser window the Global object is [object Window] : var x = this; this in a Function (Default)
Amritanjali's blog UI Source on UI related technologies like Angular, TypeScript, JavaScript, HTML, CSS.