From 38deac758e4dc6be6122ae15fbd68e2c2439553d Mon Sep 17 00:00:00 2001 From: Dean Wright Date: Fri, 6 Dec 2019 07:22:34 -0800 Subject: [PATCH 1/3] fundamentals --- fundamentals.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fundamentals.js b/fundamentals.js index e3877d9..818a5c3 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -2,30 +2,34 @@ // #1: Create an array of strings called `foods` that contains three foods. // Type your solution immediately below this line: - +var foods = ['pizza', 'oatmeal', 'apple'] // #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[3] // #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.push(foods[i]) +} // #5: Create an object literal called `instructor` that contains three key-value pairs. // Type your solution immediately below this line: - +var instructor = {instructor1: 'Sally', instructor2: 'Bob', instructor3: 'Molly'} // #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 key = 'has-office-hours' +instructor[key] = true \ No newline at end of file From 3bbce86d6d0beeea1c92502ab01e3ddd719e1664 Mon Sep 17 00:00:00 2001 From: Dean Wright Date: Fri, 6 Dec 2019 07:35:16 -0800 Subject: [PATCH 2/3] hof --- hof.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hof.js b/hof.js index c8d3baa..99cb742 100644 --- a/hof.js +++ b/hof.js @@ -20,10 +20,15 @@ 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(name) // #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 // to a variable called `polyglotPeople`. // Type your solution immediately below this line: +function checkKnownLanguages(knownLanguages) { + return knownLanguages > 1 +} +var polyglotPeople = people.filter(checkKnownLanguages) + From b9020adad6b8e40a2d6026501202be851ef1239b Mon Sep 17 00:00:00 2001 From: Dean Wright Date: Fri, 6 Dec 2019 07:51:49 -0800 Subject: [PATCH 3/3] ooj --- oojs.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/oojs.js b/oojs.js index 4c836c7..5df1376 100644 --- a/oojs.js +++ b/oojs.js @@ -5,15 +5,21 @@ // - 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: - - - +var Playlist = { + constructor(title){ + this.title = title, + this.songs = [], + this.addSong() = songs.push(song) + } +} // #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 // Type your solution immediately below this line: - +var myPlaylist = new Playlist( + addSong('Feelings') +)