Open
Description
class Rectangle {
#color
constructor(height, width, color) {
this.height = height;
this.width = width;
this.#color = color;
}
area() {
return this.height * this.width;
}
color2() {
return this.#color;
}
}
let r = new Rectangle(45,477, 'blue');
let ir = instanceToPlain(r);
console.log(ir)
let users = plainToInstance(Rectangle, ir);
console.log(users.color2()); <----------------------- undefined