Skip to content

Commit 768b0f1

Browse files
modified array.js challenge 6 to use one .push method. corrected missing trailing comma for antonietta object in object.js
1 parent fddb7ac commit 768b0f1

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

‎assignments/arrays.js‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ console.log(`${lastCar.car_year} ${lastCar.car_make} ${lastCar.car_model}`);
7777
let carModels = [];
7878
let index = 0;
7979
inventory.forEach(function (element){
80-
carModels.push(inventory[index].car_model);
80+
carModels.push(`${inventory[index].car_model}`);
8181
index++;
8282
});
8383
console.log(carModels.sort());
@@ -87,7 +87,7 @@ console.log(carModels.sort());
8787
let carYears = [];
8888
index = 0;
8989
inventory.forEach(function(element){
90-
carYears.push(inventory[index].car_year);
90+
carYears.push(`${inventory[index].car_year}`);
9191
index++;
9292
});
9393
console.log(carYears);
@@ -98,7 +98,7 @@ let oldCars =[];
9898
index = 0;
9999
carYears.forEach(function(element){
100100
if(element > 2000){
101-
oldCars.push(carYears[index]);
101+
oldCars.push(`${carYears[index]}`);
102102
}
103103
});
104104
console.log(oldCars.length);
@@ -109,9 +109,7 @@ let BMWAndAudi =[];
109109
index = 0;
110110
inventory.forEach(function(element){
111111
if(Object.values(element).includes("BMW") || Object.values(element).includes("Audi")){
112-
BMWAndAudi.push(inventory[index].car_year);
113-
BMWAndAudi.push(inventory[index].car_make);
114-
BMWAndAudi.push(inventory[index].car_model);
112+
BMWAndAudi.push(`${inventory[index].car_year} ${inventory[index].car_make} ${inventory[index].car_model}`);
115113
}
116114
index++;
117115
});

‎assignments/objects.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const antonietta = {
5252
"gender": "F",
5353
multiplyNums(x, y){
5454
return x * y;
55-
}
55+
},
5656
};
5757

5858
// ==== Challenge 2: Reading Object Data ====

0 commit comments

Comments
 (0)