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:

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

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -