class 프러퍼티 생성 예제 입니다
class Rect{
//생성자 에서 프러퍼티 추가
constructor(h,w){
this.h = h;
this.w = w;
}
}
var obj = new Rect(10,5);
console.log(obj.h,obj.w);
class Rect{
//메소드 에서 프러퍼티 추가
area(h,w){
this.h = h;
this.w = w;
return this.h*this.w;
}
}