How To Loop Through Objects In JavaScript

Author: , May 15th, 2011

Coming from the Perl world, I wanted to emulate the following code in JavaScript:

What I found is that JavaScript uses “Objects” to contain hash-style data:

Also, one may use variables as key names by using the square-bracket notation, which evaluates variables first: