July 2018
Intermediate to advanced
420 pages
8h 46m
English
The best way to understand classes in TypeScript is to create one. A simple class looks like the following code:
class Band { public name: string; constructor(text: string) { this.name = text; }}Let's create our first class:
class MyBand { // Properties without prefix are public // Available is; Private, Protected albums: Array<string>; members: number; constructor(albums_list: Array<string>, total_members: number) { this.albums = albums_list; this.members = total_members; } // Methods listAlbums(): void { console.log("My favorite albums: "); for(var i = 0; i < this.albums.length; i++) { console.log(this.albums[i]); ...Read now
Unlock full access