JavaScript Array
<p>I usually script/program using python but have recently begun programming with JavaScript and have run into some problems while working with arrays.</p>

<p>In python, when I create an array and use <em>for x in y</em> I get this:</p>

<pre><code>myarray = [5,4,3,2,1]
for x in myarray:
    print x
</code></pre>

<p>and I get the expected output of:</p>

<pre><code>5
4
3
..n
</code></pre>

<p>But my problem is that when using Javascript I get a different and completely unexpected (to me) result:</p>

<pre><code>var world = [5,4,3,2,1]
for (var num in world) {
    alert(num);
}
</code></pre>

<p>and I get the result:</p>

<pre><code>0
1
2
..n
</code></pre>

<p>How can I get JavaScript to output num as the value in the array like python and why is this happening?</p>
