diff --git a/fundamentals.js b/fundamentals.js index e3877d9..2f1815e 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -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] + "
" +} +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 diff --git a/hof.js b/hof.js index c8d3baa..4e213b8 100644 --- a/hof.js +++ b/hof.js @@ -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