DEV Community

Discussion on: The shortest way to conditional insert properties into an object literal

Collapse
 
charon92 profile image
Tom Pegler

For added fun with this, I tried a couple of things:

var state = 'tom';
var o = {
  name: 'test',
  state: state,
  ...( ( true && ( this.state = 'jamie' ) ) && false ) && { state } 

}