Answers for "javascript add value to the object on condition"

36

insert condition in a object javascript

const a = {
   ...(someCondition && {b: 5})
}
Posted by: Guest on October-22-2020
1

insert condition in a object javascript

const a = {
   ...(someCondition? {b: 5}: {} )
}
Posted by: Guest on January-04-2021

Code answers related to "javascript add value to the object on condition"

Code answers related to "Javascript"

Browse Popular Code Answers by Language