JavaScript

No description

fork
loading
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Planet {
  
  get wow() {
    return this.nice;
  }
  constructor(name) {
    this.name = name;    
  }
  getName() {
    console.log(this === earth); // => true
    return this.name;
  }
}
var earth = new Planet('Earth');  

earth.getName(); // => 'Earth'
earth.nice = 'this is wow';
console.log(earth.wow);
Native Browser JavaScript