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
@@ -63,17 +63,23 @@ let inventory = [{"id":1,"car_make":"Lincoln","car_model":"Navigator","car_year"
63
63
64
64
// ==== Challenge 1 ====
65
65
// 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*`);
console.log(`Car 33 is a ${inventory[32].car_year}${inventory[32].car_make}${inventory[32].car_model}`);
67
70
68
71
// ==== Challenge 2 ====
69
72
// 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.
70
-
letlastCar=0;
71
-
console.log();
73
+
letlastCar=inventory.filter(car=>car.id===49);
74
+
75
+
console.log(`The last car on the inventory is a ${inventory[49].car_make}${inventory[49].car_model}`);
72
76
73
77
// ==== Challenge 3 ====
74
78
// 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
75
-
letcarModels=[];
76
-
console.log();
79
+
letcarModels=inventory.map(model=>{
80
+
returnmodel.car_model
81
+
})
82
+
console.log(carModels.sort())
77
83
78
84
// ==== Challenge 4 ====
79
85
// 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