title: How to make loop values collected in array available outside the loop for future use
body: <p>Have fetch values of multiple checkbox from form ,and collected in an  array,which is now available inside the current for loop ,but i want that array to be used for future purpose outside the loop.
  Right now i am getting all values in loop only.
  but when i print the same array outside for  loop it is displaying only the last value in an array.</p>
  
  <pre><code> &lt;script&gt;
      function submitform(path){
              var ele = document.getElementsByClassName('del');
              var arr = new Array();
              for(var i=0 ; i&lt; ele.length ; i++ )
              {
                  arr['arr2'] = ele[i].value;
              }
             console.log(arr);
          }
  &lt;/script&gt;
  </code></pre>