Skip to content

Commit f08c0d3

Browse files
author
Gill Abada
committed
Completed arrays.js challenges 3.
1 parent 9391244 commit f08c0d3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

assignments/arrays.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ console.log(`Make ${inventory[lastCar-1].car_make}, Model ${inventory[lastCar-1]
8181
// ==== Challenge 3 ====
8282
// 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
8383
let carModels = [];
84-
console.log();
84+
for (let i = 0; i < inventory.length; i++) {
85+
carModels.push(inventory[i].car_model);
86+
}
87+
console.log(carModels.sort());
8588

8689
// ==== Challenge 4 ====
8790
// 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.

0 commit comments

Comments
 (0)