From 7dc02e2dad2a42193fd83341a7a6068db8de2b74 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 8 Oct 2020 16:12:49 -0400 Subject: [PATCH 1/3] prompt 1 --- fundamentals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fundamentals.js b/fundamentals.js index 61adf3e..5740615 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -2,7 +2,7 @@ // #1: Create an array of strings called `foods` that contains three foods. // Type your solution immediately below this line: - +var foods = ["pizza", "cheeseburger", "tacos"]; // #2: Access the last item in the array and assign to a variable called `last`. // Type your solution immediately below this line: From 2eca58d272b58497cb321b9a76459f5cb1be5c45 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 8 Oct 2020 16:19:27 -0400 Subject: [PATCH 2/3] first section --- fundamentals.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fundamentals.js b/fundamentals.js index 5740615..0b28992 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -6,25 +6,33 @@ var foods = ["pizza", "cheeseburger", "tacos"]; // #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.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 = { + name: "Jon", + age: 25, + location: "Arlington" + }; // #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`] = true; \ No newline at end of file From 5f69e7a37b667da8ab0236fd52529a1a792cff62 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 8 Oct 2020 16:24:14 -0400 Subject: [PATCH 3/3] second section --- oojs.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/oojs.js b/oojs.js index 4c836c7..7ca1106 100644 --- a/oojs.js +++ b/oojs.js @@ -6,7 +6,15 @@ // - an `addSong` method that adds a song (string) to the `songs` array // Type your solution immediately below this line: - +class Playlist { + constructor(input) { + this.title = input; + this.songs = []; + this.addSong = function(song) { + this.songs.push(song); + }; + } +} @@ -14,8 +22,8 @@ // 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("My playlist"); +myPlaylist.addSong("Buckets of Rain"); // NOTE: THE CODE BELOW IS FOR TESTING PURPOSES. DO NOT REMOVE OR ALTER.