title: how to fetch array keys with jQuery?
body: <p>Good afternoon. I have an array with some keys, and values in them. I then need to fetch the array keys and not the data in them. I want to do this with jQuery. I know for example that PHP has a function called array_keys(); which takes the array as a parameter and gives you an array back with each key in each index.</p>
  
  <p>This is what I came up with, and it works... the only problem is that it seems so unefficent;</p>
  
  <pre><code>var foo = [];
  foo['alfa'] = "first item";
  foo['beta'] = "second item";
  
  for (var key in foo) {
      console.log(key);
  }
  </code></pre>
  
  <p>This will output;</p>
  
  <pre><code>alfa
  beta
  </code></pre>
  
  <p>But is there any predefined function for this, as in PHP or any other more effective way of getting this?</p>