In a recent question (Using a for loop to condense code) on stack overflow, I've learned that you can loop through variable names via the window object.
After reading this I was wondering if this is considered bad habbit and if this affects performance in certain ways.
I would guess that this does lower the performance of you Javascript since you are creating a lot more variables than when you are using an array for example. but if you are accessing a variable via it's direct name "variable" vs. "window[variable]", does this have a certain impact as well? Is this a different approach for retreiving the value? Or are these 2 possibilities doing exactly the same thing?
EDIT: As @Tomalak said, it's probably useless to ask for performance problems, since I'm not experiencing them.
Since it is a bad habbit to put a lot of variable names in the window object, what would be a use case where you would use window[variable] instead of an alternative? Is there a usecase for this?
windowso you don't pollute the global namespace.