I'm looking for a command that returns the index of an element so I can use it in map functions.
Here's an example :
function myFunction() {
var a = [4,7,9];
//Looking for a way to return ["index 0 : 4", "index 1 : 7", "index 2 : 9"]
//Only workaround found so far :
var i = -1;
Logger.log(a.map(function(el) {i++; return "index " + i + " : " + el}));
}
I'm sure there's a neater way with a command that would give me the element's index, but all my google searches have been fruitless so far.