What i want is something i do every day in Python. In JS it does not work, most probably because i suck in JS.
This is the Python code that would do what i want:
>key = 'just_a_key'
>value = 5
>dict = {key: value}
>dict
{'just_a_key':5}
>dict['just_a_key'}
5
This does not work in JS, the key there will be just named 'key'. I know this is because i'm not really creating a dictionary here, but using json to create an object when i write the same code. So my question now is: How can i programmatically name the objects "keys" (or properties?) in JS?