diff --git a/checkpoint-javascript-seir b/checkpoint-javascript-seir new file mode 160000 index 0000000..e1b1be2 --- /dev/null +++ b/checkpoint-javascript-seir @@ -0,0 +1 @@ +Subproject commit e1b1be2b09a6d0d101efd940254a0f09f6fe3555 diff --git a/fundamentals.js b/fundamentals.js index e3877d9..b3219ff 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -3,29 +3,38 @@ // #1: Create an array of strings called `foods` that contains three foods. // Type your solution immediately below this line: - +foods = [ham, cheese, fish]; // #2: Access the last item in the array and assign to a variable called `last`. // Type your solution immediately below this line: - +last = fish.slice(-1)[0] // #3: Create an empty array called `favoriteFoods`. // Type your solution immediately below this line: - +favoriteFoods = [] // #4: Create a `for` loop that adds each string in `foods` to `favoriteFoods`. // Type your solution immediately below this line: - +for(i =0,i < foods.length - 1, i++) { + favoriteFoods = foods(i) +} // #5: Create an object literal called `instructor` that contains three key-value pairs. // Type your solution immediately below this line: +instructor = { + name:"bob", + city:"new york", + age: 30 + +} // #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 diff --git a/hof.js b/hof.js index c8d3baa..1c10bed 100644 --- a/hof.js +++ b/hof.js @@ -20,7 +20,11 @@ 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 = [] +var peopleNames = people.map() { + + return peopleNames +}); // #2: Use the `filter` array method to create a new, filtered array containing only diff --git a/oojs.js b/oojs.js index 4c836c7..d64449f 100644 --- a/oojs.js +++ b/oojs.js @@ -5,7 +5,25 @@ // - 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 myPlaylist { + constructor(title) { + this.title = title; + } + + constructor(song) + this.song = [] + + addSong(sng) { + song.push(sng); + return this.song + } + +} + +// Usage: +let user = new User("John"); +user.sayHi(); @@ -14,7 +32,7 @@ // 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 MyPlaylist.addSong