Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js set value in object only if defined

const value = getValue()
const destination = {
  ...(value ? { value } : {})
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #set #object #defined
ADD COMMENT
Topic
Name
8+8 =