最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Create empty array of length n - Stack Overflow

programmeradmin2浏览0评论

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 badges
Add a ment  | 

1 Answer 1

Reset to default 10

Did you try new Array(n) with a capital A?

function makeArray() {
  var a = new Array(5);
  Logger.log(a);
};
发布评论

评论列表(0)

  1. 暂无评论