I have a variable that have a dynamic value:
var location = 'state_name'
I want to use it in associative array as a key just like this:
array.push({
location: value,
...
});
It should save a key as state_name
instead of location
. How to do this?