TypeScript 類

傳統的js是使用函數和原型鏈的方式用來模擬類 es6中加入了類,class關鍵字 類 // 定義類 class Greeter { greeting: string; constructor(message: string){ this.greeting = message; // 使用this表示訪問的是類成員 } greet() { return "Hello," +
相關文章
相關標籤/搜索