function checkWho(n,b)
{
// n and be are comparing two different cells to check if the name is in the registry
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var glr = sheet.getLastColumn();
var glr2 = sheet.getLastRow();
for(var i = 9; i <= glr; i++)
{
for(var z = 10; z<= glr2; z++)
{
if( n == b)
{
var courts = sheet.getRange(3,i).getValue();
var times = sheet.getRange(z,10).getValue();
return(b+ " "+"has booked"+" "+ courts+" "+"at"+times);
}
}
}
}
我在打印出 和 中包含的值时遇到var courts
问题var times
。我的代码由两个 for 循环组成,遍历列和行并最终吐出用户名、他们预订的球场和时间。截至目前,该名称已被印刷,但法院和时代并未印刷。
它当前打印:"(name) has booked at"
当我想要它打印时:" (name) has booked court 1 at 4:30"
对情况有什么帮助吗?