I am trying to create a for loop that is equivalent to the the code below that way I don't have to type it all out each time.
var q1 = document.getElementById("q1").value;
var q2 = document.getElementById("q2").value;
var q3 = document.getElementById("q3").value;
var q4 = document.getElementById("q4").value;
var q5 = document.getElementById("q5").value;
google.script.run.AddRecord(q1, q2, q3, q4, q5);
I am particularly having a hard time declaring qi where i=1, 2, .., 5, so that way it doesn't think it's just a word or array. I have tried different things using string concatenation but can't get it to work (see started loop below). I feel like I am missing one little thing which is causing it to run into issues. I have seen different questions about this but can't get it to work.
for(var i=1; i<=5; ++i){
var "q"+i=document.getElementById("q"+i).value;
}