Problems with for( … in …)
<p>I'm somehow confused:</p>

<p>I have a list of commands like this:</p>

<pre><code>var commands = [{"command": "read"}, {"command": "write"}, {"command": "login"}];
</code></pre>

<p>If I try it access one of the commands like this it works:</p>

<pre><code>console.log(commands[0]["command"]); // Output is "read"
console.log(commands[0].command);    // Output is "read"
</code></pre>

<p>But if I try this the output is always undefined:</p>

<pre><code>for(command in commands)
    console.log(command["command"]); // undefined, undefined, undefined
</code></pre>
