Posts

Showing posts with the label foreach

Foreach in Google Apps Script

In Google Apps Script, you can do the foreach loop as the following example:  var headers = ["super", "genius", "awesome"];  for each (var header in headers) {        Logger.log(header);  }

Foreach in javascript

If you wanna use foreach to loop through an array (list) in javascript, do as the following example: var myarray = ["genius", "super", "god"]; myarray. forEach (function(value, index){     console.log(index + ": " + value); }); the result will be: 0: genius 1: super 2: god Tested in Chrome 45.