DEV Community

MOHAMED MOUROUH
MOHAMED MOUROUH

Posted on

Today's Javascript Tip: Dynamic Object Keys

This technique allows us to create object properties dynamically.

Image description

Top comments (3)

Collapse
 
alexmustiere profile image
Alex Mustiere

You can also use

const user = {};
user[[key]] = 'Alice';
Enter fullscreen mode Exit fullscreen mode
Collapse
 
mmourouh profile image
MOHAMED MOUROUH

Thank you sir

Collapse
 
namesilo profile image
NameSilo

Great!