Skip to content

Katie Gorbell JavaScript-I#96

Open
kgorbell wants to merge 4 commits intobloominstituteoftechnology:masterfrom
kgorbell:master
Open

Katie Gorbell JavaScript-I#96
kgorbell wants to merge 4 commits intobloominstituteoftechnology:masterfrom
kgorbell:master

Conversation

@kgorbell
Copy link

No description provided.

Copy link

@holly-g holly-g left a comment

Choose a reason for hiding this comment

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

Nice job, Katie!

// 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*` );

console.log('Car 33 is a ' + inventory[33].car_year + ' ' + inventory[33].car_make + ' ' + inventory[33].car_model);
Copy link

Choose a reason for hiding this comment

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

Don't forget that the index starts at 0 instead of 1. Car 33 is at index 32.

// 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.
let oldCars =[];
console.log();
for (let i=0; i <inventory.length; i++) {
Copy link

Choose a reason for hiding this comment

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

You'll need to use the carYears array instead of inventory.

let carYears = [];
console.log();
for (let i=0; i < inventory.length; i++) {
carYears[i] = inventory[i].car_year;
Copy link

Choose a reason for hiding this comment

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

carYears.push(inventory[i].car_year);



for (let i=0; i < inventory.length; i++) {
if (inventory[i].car_make === 'BMW' || inventory[i].car_make === 'Audi') {
Copy link

Choose a reason for hiding this comment

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

Consider using loose equality == as opposed to strict equality ===.

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