JavaScript this keywordThe this keyword is a reference variable that refers to the current object. Here, we will learn about this keyword with help of different examples. JavaScript this Keyword ExampleLet's see a simple example of this keyword. Output: Javatpoint Noida UP The following ways can be used to know which object is referred by this keyword. Global ContextIn global context, variables are declared outside the function. Here, this keyword refers to the window object. The call() and apply() methodThe call() and apply() method allows us to write a method that can be used on different objects. The bind() MethodThe bind() method was introduced in ECMAScript 5. It creates a new function whose this keyword refers to the provided value, with a given sequence of arguments. Next TopicJavaScript Debugging |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India