[Javascript] Conditional add prop to Object
const b = true const c = false let object = { a: 1, ...(b ? {b: 2}: {}), ...(c ? {c: 3}: {}) }; console.log(object) // { a: 1, b: 2 }
const b = true const c = false let object = { a: 1, ...(b ? {b: 2}: {}), ...(c ? {c: 3}: {}) }; console.log(object) // { a: 1, b: 2 }