create class in ts code example
Example 1: classes in typescript
class Info {
private name: string ;
constructor(n:string){
this.name = n ;
};
describe(){
console.log(`Your name is ${this.name}`);
}
}
const a = new Info('joyous');
a.describe();
Example 2: classes in ts
class Greeter { greeting: string;
constructor(message: string) { this.greeting = message; }
greet() { return "Hello, " + this.greeting; }}
let greeter = new Greeter("world");Try