0
function cleanPayment() {
  var budget = sheet.getRange(1,6,1,1).getValue();
  var cardsTotal = 0;
  for (var i = 0; i < cards.length; i++) {
    cardsTotal += Number(cards[i]);
    var perCard = budget / cardsTotal;
    var payments = [];
    payments.push(cards[i] * perCard);
  }
Logger.log(payments);
}

payments应该包含一个数组,不是吗?但Logger.log(payments)返回单个数字。是 smb 看错了吗?

先感谢您。

4

1 回答 1

1

尝试声明var payments = [];外部for循环

于 2013-10-10T08:00:26.257 回答