01 / 05
You are writing the same name three times
Look at just the names in the classes you have written so far. name turns up three times. Declared as a field, taken in as a constructor parameter, and put into this.name.
With one thing to hold it is bearable. But at four or five, that is five lines of declarations, five of parameters and five of assignments. Fifteen lines before anything actually happens.
class Cat { private name: string; constructor(name: string) { this.name = name; } call(): string { return this.name; }}const cat = new Cat("Tama");console.log(cat.call());Result
Tama