타입스크립트 readonly
[TypeScript] 타입스크립트 Getter & Setter / readonly / static
[TypeScript] 타입스크립트 Getter & Setter / readonly / static
2021.11.24🎯 타입스크립트 Getter & Setter / readonly / static 📝 타입스크립트 Getter & Setter const fullNameMaxLength = 10; class Employee { private _fullName: string; get fullName(): string { return this._fullName; } set fullName(newName: string) { if (newName && newName.length > fullNameMaxLength) { throw new Error("fullName has a max length of " + fullNameMaxLength); } this._fullName = newName; } } let employee = ne..