var a = { x: 1, fn() { console.log('this.x is ', this.x) } } class Test { constructor() { this.a = { y: 9, z: 10 } this.a = Object.assign(this.a, a) } } var test = new Test()