javascript set variable to current value as object key code example
Example: javascript set object key as variable
let variableKey = "exampleKey"
let variableValue = "exampleValue"
//Add brackets around variableKey
let data = {
[variableKey] : variableValue
}
console.log(data)
//Return {"exampleKey": "exampleValue"}