Keiran Kozlowski#241
Keiran Kozlowski#241gooseandmegander wants to merge 4 commits intobloominstituteoftechnology:masterfrom
Conversation
…mplementation of object methods.
gooseandmegander
left a comment
There was a problem hiding this comment.
Good work, Keiran. I've left some comments for you to review.
| // 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: | ||
| console.log(`Car 33 is a *car year goes here* *car make goes here* *car model goes here*` ); | ||
|
|
||
| for (i = 0; i < inventory.length; i++) { |
There was a problem hiding this comment.
Don't forget the let in the for loop: for (let i = 0 ...) { ... }. Why is the let necessary?
| let carMake = inventory[i]["car_make"]; | ||
| let carModel = inventory[i]["car_model"]; | ||
|
|
||
| console.log("Car 33 is a " + carYear + " " + carMake + " " + carModel + "."); |
There was a problem hiding this comment.
Nicely done. Look into template literals for fun: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
|
|
||
| // ==== Challenge 2 ==== | ||
| // 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. | ||
| let lastCar = 0; |
There was a problem hiding this comment.
The way you have the next line set up, you don't need this line: let lastCar = 0.
| // 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 | ||
| let carModels = []; | ||
| console.log(); | ||
| let carHolder = []; |
There was a problem hiding this comment.
Why did you choose to use 2 arrays?
| carModels = carHolder.sort(); | ||
| riolet = carModels[carModels.length - 1]; | ||
|
|
||
| carModels.splice(carModels.length - 1, 1); |
There was a problem hiding this comment.
Another approach you could've taken is to make riolet to Riolet before sorting. Then you wouldn't need to splice it in.
| let BMWAndAudi = []; | ||
|
|
||
| for (i = 0; i < inventory.length; i++) { | ||
| if (inventory[i]["car_make"] === "BMW") { |
There was a problem hiding this comment.
You could have also done something like this:
let carMake = inventory[i]['car_make'];
if (carMake === 'BMW' || carMake === 'Audi') {
BMWAndAudi.push(inventory[i]);
}
| console.log(antoniettaObj.multiplyNums(3, 4)); | ||
|
|
||
|
|
||
| // === Great work! === Head over to the the arrays.js file or take a look at the stretch challenge |
There was a problem hiding this comment.
Everything looks good here. Go for stretch if you have time!
Created PR to comment on code.