a = 123; // becomes global var var b = 234; // local var function f() {} // local func g = function() {} // got a global func
now how to print
How about:
var globals = window || global; for (var key in globals){ console.log(window[key]); }