Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions fundamentals.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,41 @@
// #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:


var 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:

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
4 changes: 3 additions & 1 deletion hof.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
13 changes: 11 additions & 2 deletions oojs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')



Expand Down