On my page I have a number of drop downs each call DD1, DD2, etc. In my database I have fields with keys accom1, accom2, etc. I’m trying to create an object using a for loop where the numerical values are replaced with a variable (i):
let updateAccom = {
“accom1”: $w(‘#accomDD1’).value,
“accom2”: $w(‘#accomDD2’).value
}
However, I don’t know the correct syntax for defining the object name as I keep on getting an error when trying this:
“accom”+(i): $w(‘#accomDD’+(i)).value
Can the objects be defined like this?