Skip to content

Commit 336b6f0

Browse files
committed
Added right Arrays file w/ corrections
1 parent e3e8b39 commit 336b6f0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

assignments/arrays.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ let inventory = [{"id":1,"car_make":"Lincoln","car_model":"Navigator","car_year"
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:
6666
//console.log(`Car 33 is a *car year goes here* *car make goes here* *car model goes here*` );
6767
for (let i = 0; i < inventory.length; i++) {
68-
if (inventory.id[i] === 33) {
69-
console.log('Car 33 is a', inventory[i].car_year, inventory[i][car_make], inventory[i].car_model);
68+
if (inventory[i].id === 33) {
69+
console.log('Car 33 is a', inventory[i].car_year, inventory[i].car_make, inventory[i].car_model);
7070
}
7171
}
7272

7373

7474
// ==== Challenge 2 ====
7575
// 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.
7676
let lastCar = 0;
77-
console.log(inventory[length-1][car_make], inventory[length-1][car_model]);
77+
console.log(inventory[inventory.length-1].car_make, inventory[inventory.length-1]["car_model"]);
7878

7979
// ==== Challenge 3 ====
8080
// 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
@@ -83,7 +83,7 @@ for (let i = 0; i < inventory.length; i++) {
8383
carModels.push(inventory[i].car_model);
8484
}
8585
carModels.sort();
86-
console.log(carModels.sort());
86+
console.log(carModels);
8787

8888
// ==== Challenge 4 ====
8989
// 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)