From 9f99acca2cff4255d665b8ebeb07802dcf419af3 Mon Sep 17 00:00:00 2001 From: Matthew Lewis Date: Thu, 8 Oct 2020 16:05:38 -0400 Subject: [PATCH 1/7] prompt 1 done --- fundamentals.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fundamentals.js b/fundamentals.js index 61adf3e..2fad047 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -2,11 +2,12 @@ // #1: Create an array of strings called `foods` that contains three foods. // Type your solution immediately below this line: +var foods = ['pizza', 'pasta', 'garlic 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[foods.length-1]; // #3: Create an empty array called `favoriteFoods`. From 458d61cbd0eecc49e52ac53f661916f3b77824b9 Mon Sep 17 00:00:00 2001 From: Matthew Lewis Date: Thu, 8 Oct 2020 16:06:03 -0400 Subject: [PATCH 2/7] prompt 2 done --- fundamentals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fundamentals.js b/fundamentals.js index 2fad047..8b596f0 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -7,7 +7,7 @@ var foods = ['pizza', 'pasta', 'garlic 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[foods.length-1]; +var last = foods[foods.length-1]; // #3: Create an empty array called `favoriteFoods`. From fb4dd49c679f943fab517fd053e137d1e1990fb9 Mon Sep 17 00:00:00 2001 From: Matthew Lewis Date: Thu, 8 Oct 2020 16:06:37 -0400 Subject: [PATCH 3/7] prompt 3 done --- fundamentals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fundamentals.js b/fundamentals.js index 8b596f0..ae82ce0 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -12,7 +12,7 @@ var last = foods[foods.length-1]; // #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`. From c95c4f9218cf6ce436b52c936f7056661751f93f Mon Sep 17 00:00:00 2001 From: Matthew Lewis Date: Thu, 8 Oct 2020 16:07:52 -0400 Subject: [PATCH 4/7] prompt 4 done --- fundamentals.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fundamentals.js b/fundamentals.js index ae82ce0..6e2f8f2 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -17,6 +17,9 @@ 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]) +} From 5c5b7bae3a70200893dd9fed5e24fda2777e2a96 Mon Sep 17 00:00:00 2001 From: Matthew Lewis Date: Thu, 8 Oct 2020 16:14:58 -0400 Subject: [PATCH 5/7] prompt 6 done --- fundamentals.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fundamentals.js b/fundamentals.js index 6e2f8f2..257aab7 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -25,6 +25,11 @@ for (let i = 0; i < foods.length; i++) { // #5: Create an object literal called `instructor` that contains three key-value pairs. // Type your solution immediately below this line: +var instructor = { + name: 'Dhruv', + lastName: 'Didi', + workXP: 'Google' +} @@ -32,3 +37,4 @@ for (let i = 0; i < foods.length; i++) { // 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"] = true; From 6fe9c1ee831adf0f38c25a6d5105f530b13e701a Mon Sep 17 00:00:00 2001 From: Matthew Lewis Date: Thu, 8 Oct 2020 16:19:11 -0400 Subject: [PATCH 6/7] oojs prompts done --- oojs.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/oojs.js b/oojs.js index 4c836c7..4b2e4ec 100644 --- a/oojs.js +++ b/oojs.js @@ -5,7 +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(string) { + this.songs.push(string); + } +} @@ -13,7 +21,8 @@ // #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(); +myPlaylist.addSong("Thick Country Skin of my Yellow Country Teeth"); From a660022da69b52ace7a5280ea928dc676b441915 Mon Sep 17 00:00:00 2001 From: Matthew Lewis Date: Thu, 8 Oct 2020 16:20:18 -0400 Subject: [PATCH 7/7] fixed the last error on oojs2 --- oojs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oojs.js b/oojs.js index 4b2e4ec..430ea45 100644 --- a/oojs.js +++ b/oojs.js @@ -21,7 +21,7 @@ class Playlist { // #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(); +var myPlaylist = new Playlist('2009 Jams'); myPlaylist.addSong("Thick Country Skin of my Yellow Country Teeth");