title: Accessing javascript variable inside {{ }} symfony twig
body: <p>I have an array arr sent from the controller to a twig template containing some JavaScript script , i want to use for loop to access rows of the array like this:</p>
  
  <pre><code>for (var i = 0; i &lt; 3; i++) {
                  alert('{{ arr[i] }}');
              }
  </code></pre>
  
  <p>But the variable i is unknown, i get this error : </p>
  
  <blockquote>
    <p>Variable "i" does not exist.</p>
  </blockquote>
  
  <p>Any suggestions?</p>