why destructuring a boolean is working. For example
const condition = true
const toto = { name: 'toto' }
const other = {
other: 'other',
...condition && toto
}
console.log({ other }) // { other: 'other', name: 'toto' }
const falseCondition = false
const otherWithoutToto = {
other: 'other',
...falseCondition && toto
}
console.log({ otherWithoutToto }) // { other: 'other' }
In the case of false boolean, we don't add property, otherwise we will. Actually it's working well but someone can explain me why is it possible?