ECMAScript 6 클래스의 게터와 세터는 무엇입니까? ECMAScript 6 클래스에서 getter와 setter의 요점이 무엇인지 혼란 스럽습니다. 목적은 무엇입니까? 아래는 제가 언급하는 예입니다. class Employee { constructor(name) { this._name = name; } doWork() { return `${this._name} is working`; } get name() { return this._name.toUpperCase(); } set name(newName){ if(newName){ this._name = newName; } } } 이러한 setter 및 getter를 사용하면 괄호를 사용하지 않고 속성을 직접 사용할 수 있습니다. var emp = n..