Sascha Schulz
2024-07-22 33d511b3a1a1b054e715b1d51c21e03c444c4ff0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function Shape() {
}
 
Shape.prototype.getType = function() {
    return "Shape";
}
 
function Rectangle(a, b) {
    this.a = a;
    this.b = b;
}
 
Rectangle.prototype = Object.create(Shape.prototype);
Rectangle.prototype.constructor = Rectangle;
 
const r = new Rectangle(2, 3);
 
console.log(r.getType());
 
Rectangle.prototype.getType = function() {
    return "Rectangle";
}
 
console.log(r.getType());