Pregunta

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?

¿Fue útil?

Solución

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

var t = "type_" + i;
var type = e['parameter'][t];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top