Skip to content

Keiran Kozlowski#241

Open
gooseandmegander wants to merge 4 commits intobloominstituteoftechnology:masterfrom
keirankozlowski:master
Open

Keiran Kozlowski#241
gooseandmegander wants to merge 4 commits intobloominstituteoftechnology:masterfrom
keirankozlowski:master

Conversation

@gooseandmegander
Copy link
Copy Markdown

Created PR to comment on code.

Copy link
Copy Markdown
Author

@gooseandmegander gooseandmegander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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++) {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 + ".");
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// ==== 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;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = [];
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you choose to use 2 arrays?

carModels = carHolder.sort();
riolet = carModels[carModels.length - 1];

carModels.splice(carModels.length - 1, 1);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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") {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good here. Go for stretch if you have time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants