title: Loop through Array and return result into Array
body: <p>I have this array:</p>
  
  <pre><code>var shareholders = [“name1”, “name2”, “name3”];
  </code></pre>
  
  <p>This is function from HPSM that is fetching data from that array:</p>
  
  <pre><code>function getShareholders(RECORD)
   {
    var fShareholder = new SCFile("device");
    var rc = fShareholder.doSelect("logical.name=\"" + RECORD + "\"");
    if (rc == RC_SUCCESS)
    {
      print(fShareholder.shareholder_contacts);
      return fShareholder.sharholder_contacts;
      }
   return null;
  }
  </code></pre>
  
  <p>It returns them in array form but I need it to fetch one by one:</p>
  
  <pre><code>var users = new Array();
  users[0] = “name1”
  users[1] = “name2”
  ….
  </code></pre>
  
  <p>I have tried them to loop through for loop but without success.</p>