Source Code: (back to article)
<!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>