代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript">
window.onload=function(){
x="this=window";
var a={
x:"this=a",
kk:function(){
console.log(this.x);
return function(){console.log(this.x);};
}
}
//alert(a.kk);
(a.kk()());
}
</script>
</head>
<body>
</body>
</html>
一段很短的代码,去掉注释可以运行,但是不去掉注释就会报错
function.html:18 Uncaught TypeError: a.kk(...) is not a function(…)