Forum Moderators: open

Message Too Old, No Replies

Finding all variables in a function

         

csdude55

6:20 pm on Sep 3, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



For the sake of debugging, I thought it might help to see every variable that's set within or sent to a function. This will let me see what's changed from one run to another.

I'm using this:

for (let variable in window) {
if (window.hasOwnProperty(variable))
console.log(variable + ' -> ' + window[variable]);
}


but it returns about 1000 variables! Most of which are really functions that aren't helpful at all (like "onblur" and "onclick").

Is there a way to narrow this down to something more usable?