title: Function with a loop
body: <p>I've one question.
  I've made one function which gives me a random array of colours.</p>
  
  <pre><code>function dameColoresRand(numero) {
      i=0;
      colores = [];
      while(i&lt; numero - 1) {
          color = '#'+(Math.random()*0xFFFFFF&lt;&lt;0).toString(16);
          if(color.length == 7) {
              colores.push(color);
              i++;
          }
      }
      return colores;
  }
  </code></pre>
  
  <p>[Sometimes color doesn't has the correct syntax, so I made a simple check]</p>
  
  <p>Well, when I call the function with a loop, for example</p>
  
  <pre><code>for (i = 0; i &lt; 3 ; i++) {
      colores = dameColoresRand(10);
      console.log(colores);
  }
  </code></pre>
  
  <p>I should see on my console, 3 hex colour code arrays.</p>
  
  <p>Why I only see one array, and nex undefined?</p>