Last active
February 12, 2023 03:21
-
-
Save Tim-W-James/3c9bce6263634f8e22cc4ca8791bc170 to your computer and use it in GitHub Desktop.
JavaScript Spread Conditional Object Attribute
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const x = { | |
...( condition && { key: value }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment