RECORDING: Learn Typescript Part 3
AboutCommentsNotes
RECORDING: Learn Typescript Part 3
Expand for more info
index.ts
run
preview
console
/* 
LEARN TYPESCRIPT PART 3
classes
interfaces
interfaces with classes
*/

//basic javascript class
class Person {
name;
isCool;
pets;

constructor(n, c, p) {
this.name = n;
this.isCool = c;
this.pets = p;
}

sayHello() {
return `Hi, my name is ${this.name} and I have ${this.pets} pets`;
}
}

const person1 = new Person('Danny', false, 2);
const person2 = new Person('Sarah', 'yes', 6);


Console
"Danny"
,
false
,
"dan@e.com"
,
1
,
"Hi John"
,
/index.html
-15:47