<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<script>
var stu ={
m: function(){
var self = this;
console.log(this === stu); // ==> true;
function f(){
//When a nested function is called, this does not point to the context in which the outer function is called
console.log(this === stu); // ==> false;
If you want to access an external function this I need to take the external function this Save it in a variable.
console.log(self === stu); // ==> true;
}
f();
}
}
</script>
<body>
</body>
</html>