当我在node.js中键入它时,我得到了undefined.
undefined
var testContext = 15; function testFunction() { console.log(this.testContext); } testFunction(); =>undefined
没有var关键字,它传递(=> 15).它在Chrome控制台中运行(有和没有var关键字).
var
javascript scope node.js
javascript ×1
node.js ×1
scope ×1