속성 (properties, fileds)
행동 (method)
# class 생성
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
speak() {
console.log('hello')
}
}
# object 생성
const human = new Person('human', 20);
console.log(human.name);
console.log(human.age);
human.speak();
Getter and setter
public vs private
private를 class내에서 지정했다면 class내에서만 접근가능상속과 다양성