diff --git a/fundamentals.js b/fundamentals.js index e3877d9..17bfdb0 100644 --- a/fundamentals.js +++ b/fundamentals.js @@ -3,29 +3,35 @@ // #1: Create an array of strings called `foods` that contains three foods. // Type your solution immediately below this line: - +var foods = ["snack", "chicken", "beans"] // #2: Access the last item in the array and assign to a variable called `last`. // Type your solution immediately below this line: - +var last = foods[foods.length - 1] +console.log(last) // #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: - +foods.forEach(e => favoriteFoods.push(e)) +console.log(favoriteFoods) // #5: Create an object literal called `instructor` that contains three key-value pairs. // Type your solution immediately below this line: +var instructor = { age: 20, experienceYears: 3, height: "5'3" } // #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 +console.log(instructor) \ No newline at end of file diff --git a/hof.js b/hof.js index c8d3baa..ed16cd1 100644 --- a/hof.js +++ b/hof.js @@ -21,9 +21,13 @@ var people = [ // called `peopleNames`. // Type your solution immediately below this line: +var peopleNames = people.map(e => console.log(e.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(e => (e.knownLanguages > 1)) +console.log(polyglotPeople) \ No newline at end of file diff --git a/index.html b/index.html index cd1f465..c3bdc40 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,19 @@ -
- -