List all global variables in Node.js

后端 未结 3 1235
隐瞒了意图╮
隐瞒了意图╮ 2021-01-01 22:25

I\'m trying to list all of the global variables, including those refering to built-in objects.

In Chrome\'s console I can simply type this and get back

3条回答
  •  被撕碎了的回忆
    2021-01-01 23:02

    You can use the Object.getOwnPropertyNames(this) .As without passing the "this" as argument or parameter referring to Object owner's properties, the getOwnPropertyNames() function won't return anything.

    Answering your question as to where the eval comes from check this link out. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval

提交回复
热议问题