title: For..In loops in JavaScript - key value pairs
body: <p>I was wondering if there's a way to do something like a PHP <code>foreach</code> loop in JavaScript. The functionality I'm looking for is something like this PHP Snippet:</p>
  
  <pre><code>foreach($data as $key =&gt; $value) { }
  </code></pre>
  
  <p>I was looking at the JS <code>for..in</code> loop, but there seems to be no way to specify the <code>as</code>. If I do this with a 'normal' for loop (<code>for(var i = 0; i &lt; data.length; i++</code>), is there a way to grab the key => value pairs?</p>