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
// 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.
85
85
letcarYears=[];
86
-
console.log();
86
+
for(leti=0;i<inventory.length;i++){
87
+
carYears.push(inventory[i].car_year);
88
+
}
89
+
console.log(carYears);
87
90
88
91
// ==== Challenge 5 ====
89
92
// The car lot manager needs to find out how many cars are older than the year 2000. Using the carYears array you just created, find out how many cars were made before the year 2000 by populating the array oldCars and logging it's length.
90
93
letoldCars=[];
91
-
console.log();
94
+
for(leti=0;i<inventory.length;i++){
95
+
if(2000-inventory[i].car_year>0){
96
+
oldCars.push(inventory[i].car_year);
97
+
}
98
+
}
99
+
console.log(oldCars.length);
92
100
93
101
// ==== Challenge 6 ====
94
102
// 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