From 1f63bd7d6d9c9a7865c4000c2baef043c74c0929 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Dec 2019 10:19:22 -0500 Subject: [PATCH 1/4] completeded fundamentals.js --- fundamentals.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fundamentals.js b/fundamentals.js index e3877d9..8a5c7bc 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -3,22 +3,27 @@ // #1: Create an array of strings called `foods` that contains three foods. // Type your solution immediately below this line: +var food = [Sphaghetti, Pizza, iceCream] // #2: Access the last item in the array and assign to a variable called `last`. // Type your solution immediately below this line: - +var last = food[2] // #3: Create an empty array called `favoriteFoods`. // Type your solution immediately below this line: - +let favoriteFoods = [] // #4: Create a `for` loop that adds each string in `foods` to `favoriteFoods`. // Type your solution immediately below this line: - +function addFoods() { + for(i = 0; i <= food.length; i ++) { + favoriteFoods.push(food) + } +} // #5: Create an object literal called `instructor` that contains three key-value pairs. // Type your solution immediately below this line: From 897ce7f74c9cf788d7b6eb47f697434e1964f479 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Dec 2019 10:19:37 -0500 Subject: [PATCH 2/4] completeded fundamentals.js --- fundamentals.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fundamentals.js b/fundamentals.js index 8a5c7bc..5710abc 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -14,7 +14,7 @@ var last = food[2] // #3: Create an empty array called `favoriteFoods`. // Type your solution immediately below this line: -let favoriteFoods = [] +var favoriteFoods = [] // #4: Create a `for` loop that adds each string in `foods` to `favoriteFoods`. // Type your solution immediately below this line: @@ -28,9 +28,16 @@ function addFoods() { // #5: Create an object literal called `instructor` that contains three key-value pairs. // Type your solution immediately below this line: +let instructor = { + name: 'Mark', + gender: 'Male', + suject: 'Science' +} // #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: + +instructor.has-office-hours = false From 48ff6c27fda2bdac5d6a5c6902747995c1527af0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Dec 2019 10:29:26 -0500 Subject: [PATCH 3/4] Finished second excersie --- hof.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hof.js b/hof.js index c8d3baa..98fa936 100644 --- a/hof.js +++ b/hof.js @@ -21,9 +21,11 @@ var people = [ // called `peopleNames`. // Type your solution immediately below this line: - +var peopleNames = people.map(poeple => people.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: + +var polyglotPeople = people.filter(people => people.knownLanguages >= 2) \ No newline at end of file From cfe1ebe4332d00820e69108d4cf7420c05128fd0 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Dec 2019 10:42:14 -0500 Subject: [PATCH 4/4] Finished third excercise --- oojs.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/oojs.js b/oojs.js index 4c836c7..3b736c9 100644 --- a/oojs.js +++ b/oojs.js @@ -7,14 +7,23 @@ // Type your solution immediately below this line: - +class playlist { + constructor(title, [songs]) { + this.title = title; + this.songs = [songs]; + } + addSong(nameOfSong) { + songs.push(nameOfSong) + }; +} // #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 = playlist +myPlaylist.addSong('Free Falling')