Dynamic property name

Hello,

I need to create an object with a single property with a dynamic name.

let key = "meh" // imagine any expression that returns a string here
let a = { key: 4 } // doesn't work

How can I achieve such a thing?

You could use Dict if you just need the JS object. Example.

1 Like