title: How to retrieve a dynamic variable from an object
body: <p>I have a js object which looks like this:</p>
  
  <pre><code>            var detailsArray = [
                                   {a0 :1,
                                    b0 :'A'},
                                   {a1 :2,
                                    b1 :'B'},
                                   {a2 :3,
                                    b2 :'C'},
                                   {a3 :4,
                                    b3 :'D'}];
  </code></pre>
  
  <p>This is how the object is created from the server side. On the client side I want to retrieve the value of all 'a's and add them to an array. The problem is that the variable name is changing depending on the index number. I have tried using underscore.js to do something like this:</p>
  
  <pre><code>          var variableA = new Array();
            for(var i = 0;i&lt;detailsArray.length;i++){
              var temp = 'a' + i;
              variableA[i] = _.pluck(detailsArray,temp);
            }              
  </code></pre>
  
  <p>But this does not work. Can anyone tell how to get the values??</p>