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
22 changes: 20 additions & 2 deletions fundamentals.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,46 @@

// #1: Create an array of strings called `foods` that contains three foods.
// Type your solution immediately below this line:
var foods = ["vegetables","meats","poultry"];
foods.sort();



// #2: Access the last item in the array and assign to a variable called `last`.
// Type your solution immediately below this line:
var foods = ["vegetables","meats","poultry"];
foods[2] = "milk";
console.log(length.favoriteFoods);







// #3: Create an empty array called `favoriteFoods`.
// Type your solution immediately below this line:

var favoriteFoods = [dal, roti, chapati, rice];
function empty() {
favoriteFoods = [];
}
console.log(favoriteFoods);


// #4: Create a `for` loop that adds each string in `foods` to `favoriteFoods`.
// Type your solution immediately below this line:


var i = favoriteFoods
for (i = 0; i < foods; i++) {
Text +=foods[i] + "<br>"
}
console.log(foods);

// #5: Create an object literal called `instructor` that contains three key-value pairs.
// Type your solution immediately below this line:


var person = { firstName: "kaile", lastName: "John", age: "50"};

// #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
Expand Down
18 changes: 17 additions & 1 deletion hof.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,23 @@ var people = [
// person in the `people` array. Assign the returned array to a variable
// called `peopleNames`.
// Type your solution immediately below this line:

var people = [
{
name: "Layla",
age: 27,
knownLanguages: 3
}, {
name: "Keanu",
age: 54,
knownLanguages: 1
}, {
name: "Jasmine",
age: 35,
knownLanguages: 2
}
];
var people = [Layla, keanu, Jasmine]
var peopleNames = people.map(Math.sqrt)


// #2: Use the `filter` array method to create a new, filtered array containing only
Expand Down