I have a javascript callback function which queries my database using a set of parameters. The parameters are set using an object. How can I set the name of one of the properties dynamically?
Right now I have them all just written out. It works fine, it's just a little long. I just need to change the value of two property names. Where propertyNameToChange is in my example code.
var paramToChange = { /* I need to change the name of this property */
propertyNameToChange: { /* And the name of this property */
url: {
ComparisonOperator: 'EQ',
AttributeValueList: [{
S: alreadySetWithVar /* This is already set using a var */
}]
}
},
TableName: 'ximoRep',
IndexName: 'url-index'
}
.... // I have about 10 of these written out. Then my callback function queries using an array using the var name for the object.
var params = [paramOne, paramTwo, paramThree, paramFour, paramFive, paramSix, paramSeven, paramEight];