[removed] enumerate global vars

前端 未结 3 902
南旧
南旧 2021-01-27 05:52
a = 123; // becomes global var

var b = 234; // local var

function f() {} // local func

g = function() {} // got a global func

now how to print

3条回答
  •  离开以前
    2021-01-27 06:23

    All global variables are stored on the window object in a browser. Alternatively, they are stored on the global or GLOBAL object in Node.js. You can enumerate that object's keys instead, but keep in mind that it will contain much, much more than user-defined globals.

提交回复
热议问题