Skip to content

Commit 5ee838a

Browse files
Barbara HunterBarbara Hunter
authored andcommitted
updated arrays.js
1 parent 05715f9 commit 5ee838a

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

‎assignments/arrays.js‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,23 @@ let inventory = [{"id":1,"car_make":"Lincoln","car_model":"Navigator","car_year"
6363

6464
// ==== Challenge 1 ====
6565
// The dealer can't recall the information for a car with an id of 33 on his lot. Help the dealer find out which car has an id of 33 by logging the car's year, make, and model in the console log provided to you below:
66-
console.log(`Car 33 is a *car year goes here* *car make goes here* *car model goes here*` );
67-
66+
//
67+
for (let i = 0; i < 50; i++) {
68+
if (inventory[i].id === 33) {
69+
console.log (inventory[i]);
70+
}
71+
}
72+
6873

6974

7075
// ==== Challenge 2 ====
7176
// 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.
72-
let lastCar = 0;
73-
console.log();
77+
for (let lastCar = 0; lastCar < inventory.length; lastCar++){
78+
if (inventory[lastCar].id === inventory.length) {
79+
console.log (inventory[lastCar]);
80+
}
81+
}
82+
7483

7584
// ==== Challenge 3 ====
7685
// 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

0 commit comments

Comments
 (0)