I have this simple dictionary:
var x = {'pitchName': 'pitch1'}
console.log(x.pitchName)
>> pitch1
Now I want to create a dictionary for something like:
{x.pitchName : 'data'}
However that throws and error.
If I try:
var z = x.pitchName
{z: 'data'}
that just returns:
{z: 'data'}
How can I create a dictionary where the key is the value of a previous dictionary? End goal is:
{pitch1: 'data'}
var obj = {[x.pitchName]: 'data'}?