main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Game {  
  constructor(name) {
    this.name = name;
  }

  getMessage() {
    return `I like ${this.name}!`;
  }
}

const doom = new Game('Doom');  

const doomClone = {  
  ...doom
};

console.log(doomClone instanceof Game) // => false  
console.log(doomClone.name);           // => "Doom"  
console.log(doomClone.getMessage());  
// TypeError: doomClone.getMessage is not a function
Babel Compiler v6.4.4 Copyright (c) 2014-2015 Sebastian McKenzie