문제

Another simple task that google script will not do easily.

I have the following code

for(var i = 0; i <= cnt; ++i) {

   var type = e.parameter.type_+i;
}

A simple for loop, that loops through to grab the values of different post values. I have multiple inputs being sent to the script with the same name type but different numbers at the end. ie type_0, type_1. The problem is I cannot get the write combination to do this same thing through a for loop in google script.

Any ideas to get this to work right?

도움이 되었습니까?

해결책

Not tested, but try bracket notation instead of dot notation.

var t = "type_" + i;
var type = e['parameter'][t];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top