title: Loop an array in Google Apps Scripts
body: <p>I'm trying to write a loop for an array but getting an invalid string error.</p>
  
  <p>If keyword = "mesothelioma|seo"</p>
  
  <pre><code>function json(keyword) {
    var jsondata = UrlFetchApp.fetch("http://api.grepwords.com/lookup?apikey=carterq="+keyword);
    var object = Utilities.jsonParse(jsondata.getContentText());
  
    var results = Array("Error", "Error", "Error", "Error");
  
    for (var i = 0; i &lt; object.length; i++) {
  
    results[0] = object[0].cpc;
    results[1] = object[0].cmp;
    results[2] = object[0].lms;
    results[3] = object[0].m1;
    }
  
    return results;
  }
  </code></pre>
  
  <p>Any thoughts?</p>