I am trying to create a function that returns a two-element array value in Google Apps Script. Apparently I have misunderstood something because I thought that would be a simple matter of specifying:
return [ value1 ][ value2 ]
at the end of the function, but that is not working for me. So as a proof of concept, I wrote the following:
function testReturnArray() {
var theValue = returnArray();
Logger.log(theValue);
}
function returnArray() { return ["a"]["b"]; }
When I run this code through the debugger, the log written is:
6:33:08 PM Info null
Clearly that's not my intended result. Can you please point me to the problem? I really would like to have two values returned from this function, and this is the easiest way I could think to do that. (Alternative being to return a class, but that may be overkill for my goal, and may also have a similar issue.)
[value1,value2]? or[[value1],[value2]]???function returnArray() { return ["a","b"]; }orfunction returnArray() { return [["a"],["b"]]; }depending on whether you want an array of elements or an array of arrays.