Try to execute
for (var i = 0; i < strs.length; i++) {
var name = strs[i];
o[name] = i;
}
This code will create properties with data nameon the object o. After starting the cycle, you can access them in this way
var sum = o.a1 + o.a2 + o.a3;
Here's a script in which there is sample code
source
share