Get all javascript variables in a document

Is there a way to get all the Javascript variables on the page?

For example, Firebug can view all JS-vars, so I know that this is possible, but I'm not sure how to do it.

+3
source share
2 answers

To get global variables:

var x=[];
for (var i in window){
    x.push(i)
};
alert(x.join("\\"));

They are stored in the window object.

You can see more information here:

http://seanmonstar.com/post/708979238/iterating-global-variables-in-internet-explorer

+4
source

, , , ( ) , , .

, , , . Firebug , , .

0

Source: https://habr.com/ru/post/1774128/


All Articles