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!

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay