repl.it
fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class A {
	static get index() {
		throw new TypeError(`not implemented`);
	}

	static getById(id) {
		return {
			index: this.index,
			id,
		}
	}
}

class B extends A {
	static get index() {
		return 'user'
	}

	static getById(id, name) {
		return {
			...super.getById(id),
			name,
		}
	}
}

let b = new B();

console.log(B.getById(1, 'alex'))
?