From 520beea7dbaf2e0e1815b2f9009edbd99b493f3a Mon Sep 17 00:00:00 2001 From: Mark Holmes Date: Fri, 6 Dec 2019 10:00:08 -0600 Subject: [PATCH] No more time --- fundamentals.js | 20 ++++++++++++++------ hof.js | 4 +++- oojs.js | 11 ++++++++--- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/fundamentals.js b/fundamentals.js index e3877d9..08bd357 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -3,29 +3,37 @@ // #1: Create an array of strings called `foods` that contains three foods. // Type your solution immediately below this line: - +var foods = ["fruit", "meat", "bread"] // #2: Access the last item in the array and assign to a variable called `last`. // Type your solution immediately below this line: - +var last = foods[2] // #3: Create an empty array called `favoriteFoods`. // Type your solution immediately below this line: - +var favoriteFoods = [] // #4: Create a `for` loop that adds each string in `foods` to `favoriteFoods`. // Type your solution immediately below this line: - - +for (let i = 0; i < foods.length; i++) { + favoriteFoods = favoriteFoods +foods[i] +} // #5: Create an object literal called `instructor` that contains three key-value pairs. // Type your solution immediately below this line: - +var instructor = {last: "smith", first: "bob", prefix: "dr"} // #6: Add a `has-office-hours` (spelled exactly) property to `instructor` by accessing // it (do not change the original object you typed above) and assigning it // a boolean value. // Type your solution immediately below this line: + +var instructor = { + last: "smith", + first: "bob", + prefix: "dr", + ["has-office-hours"]: true, +} diff --git a/hof.js b/hof.js index c8d3baa..e8ec993 100644 --- a/hof.js +++ b/hof.js @@ -21,7 +21,9 @@ var people = [ // called `peopleNames`. // Type your solution immediately below this line: - +//var map1 = people.map( people.name , homeless) +var x = people.map(homeless = people.name) +console.log(homeless) // #2: Use the `filter` array method to create a new, filtered array containing only // persons from the `people` array who know multiple languages. Assign the returned array diff --git a/oojs.js b/oojs.js index 4c836c7..5d5c5f6 100644 --- a/oojs.js +++ b/oojs.js @@ -5,9 +5,13 @@ // - 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(){ + this.title = x + this.songs = y + this.addSong(Playlist.push(y)) + } +} // #2: Create an instance of the Playlist class and set it to a variable called `myPlaylist` @@ -18,6 +22,7 @@ + // NOTE: THE CODE BELOW IS FOR TESTING PURPOSES. DO NOT REMOVE OR ALTER. if(typeof Playlist !== 'undefined') { module.exports = {