title: Javascript forEach as special variable
body: <p>I am trying to understand the code of radial progress bar made using svg here but i am not able to understand the var forEach used here in following part.
  is it some specialy defined variable because it is not working if we replace it with other variable like temp etc. and also please explain the source of parameters passed into the function.</p>
  
  <pre><code>var forEach = function (array, callback, scope) {
       for (var i = 0; i &lt; array.length; i++) {
       callback.call(scope, i, array[i]);
       }}
  </code></pre>
  
  <p>here is the complete code: 
  help will be appreciated :)</p>
  
  <pre><code>&lt;script type="text/javascript" src="js/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        $(document).ready(function(){
  
          var con = "&lt;div class='center'&gt;&lt;/div&gt;";
          $("body").prepend(con);
             var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
  
               svg.setAttributeNS(null, 'width', '200px');
               svg.setAttributeNS(null, 'height', '280px');
               svg.setAttributeNS(null, 'class', 'progress');
               svg.setAttributeNS(null, 'data-progress', '65');
               $('.center').prepend(svg);
  
               var path = document.createElementNS("http://www.w3.org/2000/svg", "path");
               path.setAttributeNS(null, 'class', 'fill');
               path.setAttributeNS(null, 'd', 'M5,40a35,35 0 1,0 70,0a35,35 0 1,0 -70,0');
               $("svg").prepend(path);
  
               var spath = document.createElementNS("http://www.w3.org/2000/svg", "path");
               spath.setAttributeNS(null, 'class', 'track');
               spath.setAttributeNS(null, 'd', 'M5,40a35,35 0 1,0 70,0a35,35 0 1,0 -70,0');
               $("svg").prepend(spath);
  
               var forEach = function (array, callback, scope) {
                    for (var i = 0; i &lt; array.length; i++) {
                      callback.call(scope, i, array[i]);
                   }}
       window.onload = function(){
         var max = -219.99078369140625;
         forEach(document.querySelectorAll('.progress'), function (index,value){
         percent = value.getAttribute('data-progress');
         value.querySelector('.fill').setAttribute('style',
         'stroke-dashoffset: ' + ((100 - percent) / 100) * max);});}})
   &lt;/script&gt;
  </code></pre>