Skip to content

Commit f63029b

Browse files
sofialevinsofialevin
authored andcommitted
Completed Challenge 6 in arrays.js file.
1 parent 492b8ea commit f63029b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎assignments/arrays.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,11 @@ console.log(oldCars.length);
111111
// ==== Challenge 6 ====
112112
// 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.
113113
let BMWAndAudi = [];
114-
console.log();
114+
115+
for (let i = 0; i < inventory.length; i++) {
116+
if (inventory[i]['car_make'] === 'Audi' || inventory[i]['car_make'] === 'BMW') {
117+
BMWAndAudi.push(inventory[i])
118+
}
119+
}
120+
121+
console.log(JSON.stringify(BMWAndAudi));

0 commit comments

Comments
 (0)