Print all variables?

javascript

Solution

This will probably do what you're looking for:

console.dir(window);

Problem

I want to do a function that can be used a lot in debugging that print all variables with their values. It would alert: x=3 y=2 The function would be like that : Exemple : ``` var text=''; for(var a=0;a<allVariables;a++) { text+=nameOfVariable + " = " + valueOfVariable + "/n"; } alert(text); ```

Original source

Related problems