Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <body> <script> let context = "global"; let obj = { context: "object", method: function() { function func() { let context = "function"; return this + ":" + this.context; }; return func(); //invoked without context } }; alert(obj.method()); //[object Window]:global </script> </body> </html>