let displayAge = true 

let user = {
  name: Olusola,
  ...(displayAge && { age: 10 })
}

Don’t forget to share!

Categorized in: