Javascript equivalent of Python's locals()?

后端 未结 6 1567
离开以前
离开以前 2020-11-29 11:54

In Python one can get a dictionary of all local and global variables in the current scope with the built-in functions locals() and globals(). Is t

6条回答
  •  旧巷少年郎
    2020-11-29 12:45

    AFAIK, no. If you just want to check the existence of a given variable, you can do it by testing for it, something like this:

    if (foo) foo();
    

提交回复
热议问题