DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR JAVASCRIPT
Conditionally add members to an object
const condition = true const obj = Object.assign({}, condition ? { b: 5 } : null) console.log(obj)
Source by hohanga.medium.com #
PREVIOUS
NEXT
Tagged:
#Conditionally
#add
#members
#object
ADD COMMENT
Topic
COMMENT
Name
8+6 =
Submit