Created
May 31, 2019 08:16
-
-
Save jportella93/2189bbdeb4e764d0c5ccffb246e3e426 to your computer and use it in GitHub Desktop.
Conditionally add property to an object JavaScript ES6
This file contains 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 a = { | |
...(someCondition && {b: 5}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment