TypeScript example
TypeScript example
by nimishgoel056
TypeScript
class Student {
fullname : string;
constructor(public firstname, public middleinitial, public lastname) {
this.fullname = firstname + " " + middleinitial + " " + lastname;
}
}
interface Person {
firstname: string;
lastname: string;
}
class Song {
track: number;
seconds: number;
}
class Album {
songs: Song[];
}
function getValue(property: keyof Song | Album): any{
alert(property);
}
var user = new Student("Jane", "M.", "User");
document.body.innerHTML = getValue(new Song());