Pretty basic question but does anyone know how to create an empty array in Google Apps Script with a defined integer length n
. Tried new array(n)
but don't think its part of the Google Apps Script spec.
I know I can do it with with a loop (or manually typing it out) but wondered if there is a more elegant solution
Pretty basic question but does anyone know how to create an empty array in Google Apps Script with a defined integer length n
. Tried new array(n)
but don't think its part of the Google Apps Script spec.
I know I can do it with with a loop (or manually typing it out) but wondered if there is a more elegant solution
Share Improve this question edited Aug 14, 2019 at 19:14 Wicket 38.5k9 gold badges78 silver badges193 bronze badges asked Aug 14, 2019 at 17:27 Chris BarrettChris Barrett 6017 silver badges25 bronze badges1 Answer
Reset to default 10Did you try new Array(n)
with a capital A?
function makeArray() {
var a = new Array(5);
Logger.log(a);
};