From 3eb8f3076d20dba074d4c728a57f9f315049994a Mon Sep 17 00:00:00 2001 From: SAMUEL HAILE Date: Mon, 12 Feb 2018 09:35:32 -0500 Subject: [PATCH] oojs #1 --- hof.js | 2 +- oojs.js | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hof.js b/hof.js index c8d3baa..092d146 100644 --- a/hof.js +++ b/hof.js @@ -20,7 +20,7 @@ var people = [ // person in the `people` array. Assign the returned array to a variable // called `peopleNames`. // Type your solution immediately below this line: - +var peopleNames = people.map(person => (person.name)) // #2: Use the `filter` array method to create a new, filtered array containing only diff --git a/oojs.js b/oojs.js index 4c836c7..14741b0 100644 --- a/oojs.js +++ b/oojs.js @@ -5,10 +5,15 @@ // - a `songs` property that is an empty array not determined by input (not passed into the constructor) // - an `addSong` method that adds a song (string) to the `songs` array // Type your solution immediately below this line: - - - - +class Playlist { + constructor (title){ + this.title = title + this.songs = [] + } + } + addSong(newSong){ + this.songs.push(newSong) + } // #2: Create an instance of the Playlist class and set it to a variable called `myPlaylist` // Call the instance's `addSong` method to add a song to the instance's `songs` array