-
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathb-set.js
More file actions
15 lines (12 loc) · 314 Bytes
/
Copy pathb-set.js
File metadata and controls
15 lines (12 loc) · 314 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict';
class Rect {
toString() {
return `[${this.x}, ${this.y}, ${this.width}, ${this.height}]`;
}
}
const p1 = { x: 10, y: 20, width: 50, height: 50 };
Object.setPrototypeOf(p1, Rect.prototype);
//p1.__proto__ = Rect.prototype;
console.log(p1);
console.log(p1.toString());
console.log(`${p1}`);