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);
This will probably do what you're looking for:
console.dir(window);
You should use console methods, it's the best for debugging. Quite all modern browsers have the console, and you can use better debugging tools like firebug for firefox. Then a simple console.log(allVariables)
and it is all shown in the console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With