Home
<!DOCTYPE html> <html> <body> <h1>Demo: this keyword </h1> <script> var myVar = 100; function WhoIsThis() { var myVar = 200; alert("myVar = " + myVar); alert("this.myVar = " + this.myVar); }; WhoIsThis(); // inferred as window.WhoIsThis() </script> </body> </html>
Result: