Access all local variables

前端 未结 2 1036
别跟我提以往
别跟我提以往 2020-12-06 05:26

Every global variable in javascript is a property of \'window\'

Apparently all local variable (aswell as arguments) are stored as properties of the \'Call object\' (

相关标签:
2条回答
  • 2020-12-06 06:03

    No. There is no way of doing this in any browser implementation of JavaScript.

    It's theoretically possible that an implementation could provide an extension to allow code to inspect the current Variable object (aka the Activation object within a function; "Call object" is a term made up by Flanagan that is not mentioned anywhere within the ECMAScript spec) but no implementation I know of does this.

    0 讨论(0)
  • 2020-12-06 06:24

    You get an implicit array called "arguments" in every function but beside this there is no such thing.

    0 讨论(0)
提交回复
热议问题