solved task 2

This commit is contained in:
schrom01
2022-10-20 10:56:45 +02:00
parent b5dfdc4cdd
commit 749fe3a3fb
97 changed files with 19785 additions and 0 deletions
@@ -0,0 +1,24 @@
function Player() {
}
Player.prototype.play = function(song) {
this.currentlyPlayingSong = song;
this.isPlaying = true;
};
Player.prototype.pause = function() {
this.isPlaying = false;
};
Player.prototype.resume = function() {
if (this.isPlaying) {
throw new Error("song is already playing");
}
this.isPlaying = true;
};
Player.prototype.makeFavorite = function() {
this.currentlyPlayingSong.persistFavoriteStatus(true);
};
module.exports = Player;
+10
View File
@@ -0,0 +1,10 @@
function Song(title) {
this.title = title
}
Song.prototype.persistFavoriteStatus = function(value) {
// something complicated
throw new Error("not yet implemented");
};
module.exports = Song;