You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b750084
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: assignments/arrays.js
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -74,12 +74,17 @@ for (let i = 0; i < inventory.length; i++) {
74
74
// The dealer needs the information on the last car in their inventory. What is the make and model of the last car in the inventory? Log the make and model into the console.
// The marketing team wants the car models listed alphabetically on the website. Sort all the car model names into alphabetical order and log the results in the console
81
81
letcarModels=[];
82
-
console.log();
82
+
83
+
for(leti=0;i<inventory.length;i++){
84
+
carModels.push(inventory[i]['car_model']);
85
+
}
86
+
87
+
console.log(carModels.sort());
83
88
84
89
// ==== Challenge 4 ====
85
90
// The accounting team needs all the years from every car on the lot. Create a new array from the dealer data containing only the car years and log the result in the console.
@@ -94,7 +99,4 @@ console.log();
94
99
// ==== Challenge 6 ====
95
100
// A buyer is interested in seeing only BMW and Audi cars within the inventory. Return an array that only contains BMW and Audi cars. Once you have populated the BMWAndAudi array, use JSON.stringify() to show the results of the array in the console.
0 commit comments