title: Unexpected token error in for loop, why?
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var ccode = ['EUR', 'BRL', 'RUB', 'KRW', 'RON', 'CHF'];
    var i;
    for (var i = 0; i &lt; ccode.length; i++) {
       var ccode[i] = fx.convert(amount, {to: 'ccode[i]'});
    }</code></pre>
  </div>
  </div>
  </p>
  
  <p>The bit above <code>var ccode[i]</code> is causing an error </p>
  
  <blockquote>
    <p>SyntaxError: Unexpected token '['. Expected ';' after variable
    declaration.</p>
  </blockquote>
  
  <p>I am still new to JS so please bear with me.</p>
  
  <p>I am editing my question here since people asked why I was re-declaring var ccode[i] and its because I need to output this:</p>
  
  <pre><code>var EUR = fx.convert(amount, {to: "EUR"});
  </code></pre>