Skip to content

Instantly share code, notes, and snippets.

@chalkers
Created June 15, 2015 09:05
class Media {
constructor(title, duration, isPlaying = false) {
this.title = title;
this.duration = duration;
this.isPlaying = isPlaying;
}
start() {
this.isPlaying = true;
}
stop() {
this.isPlaying = false;
}
}
class Song extends Media {
constructor(title, artist, duration, isPlaying = false) {
super(title, duration, isPlaying);
this.artist = artist;
}
toString() {
return `<li>
${this.title} - ${this.artist} <span>${this.duration}</span>
</li>`;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment