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