title: Vue JavaScript create variable from an other variable value
body: <p>I can't find how to create a variable from another variable value.</p>
  
  <p>I get this variable from AJAX call (using <code>vue-resources</code>):</p>
  
  <pre><code>langs: {1:'fr', 2:'en', 3:'ar'},
  </code></pre>
  
  <p>But, I don't know how many properties <code>langs</code> will have.  </p>
  
  <p>How can I get this variable dynamically:</p>
  
  <pre><code>newVar: {
    has_lang: '1',
    values: [{ is: 'fr', val:''}, { is: 'en', val:''}, { is: 'ar', val:''}]
  },
  </code></pre>
  
  <p>So in <code>newVar</code>, the <code>fr</code>, <code>en</code>, and <code>ar</code> properties have been generated automatically using the values in <code>langs</code>.</p>
  
  <p>I am planning to use the <code>values</code> array to bind to the values of my <code>md-input</code> inputs using v-model:</p>
  
  <pre><code>&lt;md-input-container v-for="value in newVar.values"&gt;
    &lt;label&gt;@{{ attribute.attribute }} @{{ value.is }}&lt;/label&gt;
    &lt;md-input v-model="value.val"&gt;&lt;/md-input&gt;
  &lt;/md-input-container&gt; 
  </code></pre>
  
  <p>Is doing this manipulation the best practice? Because I can't find a solution which uses <code>v-model</code> for inputs that are generated from a <code>v-for</code> loop.</p>