TypeScript1 [TypeScript] 클래스와 객체 생성 🔍 코드class Student{ name:string age:number gender:string constructor(name:string, age:number, gender:string){ this.name = name; this.age = age; this.gender = gender; } hello(){ console.log(this.name+' : 안녕하세요'); }}const kim = new Student('kim', 25, '남');kim.hello(); TypeScript로 작성된 클래스 Student를 정의하고, 이를 활용하여 kim이라는 객체를 생성하여 메소드를 호출한다.여기서 클래스 Stude.. TypeScript 2024. 5. 30. 이전 1 다음