在node.js模块和函数中“this”的含义
require.
// loaded by require()var a = this; // "this" is an empty objectthis.anObject = {name:"An object"};var aFunction = function() {
var innerThis = this; // "this" is node global object};aFunction();(function(anyParameter){
console.log(anyParameter.anObject);})(
this // "this" is same having anObject. Not "global");thisa = this;thisthisthisthis
globalthis
喵喔喔
随时随地看视频慕课网APP
相关分类