Passing single value from array

Skip to first unread message

Jan 26, 2022, 2:37:01 PMJan 26
to Google Apps Script Community
I'm having trouble passing a single value from an array into another function.  The purpose of this call is to pass the entries from the array, one at a time, were a calculation is done using those values.  However, the entire array is being passed.

for (var j = 0; j <= 15; j++) {
course = week_course[j];
score = VP_Scores[j];
handicap = CalcWeeklyHandicap (score,course);

In the above, the variables "course" and "score" contain the entire array as opposed to the value only in the "j" entry of the table.

I tried originally passing the week_course[j] and VP_Scoring[j] variables and then tried this iteration but both resulted in the entire array being passed.

How can I pass just the value in the "j" entry of the table.


Dan Prendergast

Jan 26, 2022, 3:53:51 PMJan 26
I think I have this figured out, kind of.  The week_course variable is a 2 dimension array.  I’m not sure why, but this was the problem.  


You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Robert B Johnson

Jan 27, 2022, 6:15:10 AMJan 27
to Google Apps Script Community
I had ran into that very same issue,, the way I figured it out was to use "logger.log" this is like "Console.log" in traditional JS  only then did I see that the array I was targeting was wrapped in a second array

"  [ [ 1,2,3,4,5] ]"    


Reply all
Reply to author
0 new messages