var n = 'window' var o = { n: 'my', myfunc: function() { console.log(this.n); }, myfun2: function() { //箭头函数可以 return () => { console.log(this.n); } }, myfun3: function() { //闭包 var that = this; return function() { console.log(that.n); } } myfun4: function() { //bind return (function() { console.log(this.n) }).bind(this) } };