diff --git a/fundamentals.js b/fundamentals.js index 61adf3e..6f286a3 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -3,28 +3,41 @@ // #1: Create an array of strings called `foods` that contains three foods. // Type your solution immediately below this line: +let foods = ["chicken" , "pizza", " spaghetti"] + // #2: Access the last item in the array and assign to a variable called `last`. // Type your solution immediately below this line: - +let last = foods[2] // #3: Create an empty array called `favoriteFoods`. // Type your solution immediately below this line: - +const favoriteFoods = [] // #4: Create a `for` loop that adds each string in `foods` to `favoriteFoods`. // Type your solution immediately below this line: - +let foods; +let favoriteFoods = foods.length; +for (i=0; i < favoriteFoods.length; i++) { +console.log(favoriteFoods) +} // #5: Create an object literal called `instructor` that contains three key-value pairs. // Type your solution immediately below this line: - +let instructor = { + teachingStyle: good, + personality: friendly, + job: generalAssembly +} // #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"] = "yes"; + diff --git a/oojs.js b/oojs.js index 4c836c7..bb9c2dd 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(title, songs) { + this.title = title + this.songs = songs + } + +addSong() { + console.log("Oops, I did it Again by Britney Spears") +} @@ -14,6 +22,7 @@ // Call the instance's `addSong` method to add a song to the instance's `songs` array // Type your solution immediately below this line: +const newSong = new Playlist()