I am experiencing a javascript bug in internet explorer and I suspect its due to a name of a div matching with a global object.
My application loads many javascript libraries.
I want to find what global objects are loaded at runtime
Since all user JS defined global objects/vars are properties of the window object, you can list all the enumerable ones with this:
for (var item in window) {
console.log(item);
}
This will get you a list of a lot of things including all global functions. If you want to filter out global functions, you can use this:
for (var item in window) {
var type = typeof window[item];
if (type != "function") {
console.log(item + " (" + type + ")");
}
}
global object. So, instead of iterating properties of the window object, you would iterate properties of the global object. Note, it's also possible to have global properties that are configured to not be enumerable so they wouldn't show up. And, as this is a really old answer, one may now want to use Object.keys(global) to get all the property names instead of for/in).