frontend-playground/ts-webpack/index.ts

24 lines
558 B
TypeScript
Raw Permalink Normal View History

2021-07-16 12:46:24 +01:00
class Student {
fullName: string;
constructor(
public firstName: string,
public middleInitial: string,
public lastName: string
) {
this.fullName = firstName + " " + middleInitial + " " + lastName;
}
}
interface Person {
firstName: string;
lastName: string;
}
function greeter(person: Person) {
return "Hello, " + person.firstName + " " + person.lastName;
}
// let user = new Student("Jane", "M.", "User");
let user = new Student("Jane", "M.", "User");
document.body.textContent = greeter(user);