How to find all the JavaScript globals in browser code which are not part of the DOM, host objects, etc? -
this question has answer here:
- get user defined window properties? 3 answers
in javascript in browser global variables stored members of window
host object.
but in window
properties of window
part of browser dom and, if assume correctly, other global functions , objects host objects or otherwise part of implementaton / environment provided browser.
how can iterate through members of window
, filter out as possible not regular global variable created code such var foo = 1;
?
why don't try:
keys(window);
the object.keys() method returns array of given object's own enumerable properties, in same order provided for...in loop (the difference being for-in loop enumerates properties in prototype chain well).
reference: https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/object/keys
Comments
Post a Comment