Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

conditionally add property to object ts

const a = {
   ...(someCondition && {b: 5})
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #conditionally #add #property #object #ts
ADD COMMENT
Topic
Name
8+3 =