griffinmt Posted March 5, 2014 Share Posted March 5, 2014 What is a good/correct way to generate a list of all variable names currently in use, and preferably along with their type? Link to comment Share on other sites More sharing options...
thescientist Posted March 5, 2014 Share Posted March 5, 2014 what do you mean, "in use"? At runtime, or just doing a find / search in your IDE? Link to comment Share on other sites More sharing options...
Ingolme Posted March 5, 2014 Share Posted March 5, 2014 There are far more variable names in use than just the ones you declare, so there's no way to just get a list of the ones you created .The question is why you need them, though. This will show you everything that's in the global scope but it's probably much more than what you want to see. var output = "";for(i in window) { output += (typeof window[i]) + " " + i + " : " + window[i] + "n";}alert(output); 1 Link to comment Share on other sites More sharing options...
griffinmt Posted March 5, 2014 Author Share Posted March 5, 2014 Ingolme - That is exactly what I wanted. I can filter out certain types (such as functions). Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now