title: How to get loop value outside the loop
body: <p>How to get the loop values outside the loop below example only prints the last value, For example if i wanted to print the loop results. </p>
  
  <pre><code>var result;
  
      for (var i=0; i &lt; 10; i++) {
            result = i;
      }
  
      console.log(result);
  </code></pre>
  
  <p>Now how can i get the iterated values of the loop which are (1 to 10) in the console, because now i will only print the last value which is 10.</p>