Javascript - dumping all global variables

后端 未结 8 1905
迷失自我
迷失自我 2020-11-28 05:39

Is there a way in Javascript to get a list or dump the contents of all global variables declared by Javascript/jQuery script on a page? I am particularly interested in array

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-28 06:22

    To get "globals" object you can use this function:

    function globals() { return this; }
    

    Here is the test: http://jsfiddle.net/EERuf/

提交回复
热议问题