Skip to content

Andrew Ghobrial - JavaScript-I#179

Open
ghobs91 wants to merge 6 commits intobloominstituteoftechnology:masterfrom
ghobs91:master
Open

Andrew Ghobrial - JavaScript-I#179
ghobs91 wants to merge 6 commits intobloominstituteoftechnology:masterfrom
ghobs91:master

Conversation

@ghobs91
Copy link

@ghobs91 ghobs91 commented Aug 6, 2018

@gooseandmegander
Copy link

Thank you for your PR.

Copy link

@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.

Nice work, Andrew. I've left a few comments for you to review. If you have time, go for the stretch.

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[32].car_year + " " + inventory[32].car_make + " " + inventory[32].car_model);

Choose a reason for hiding this comment

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

console.log('==== Challenge 2 ====');
// ==== 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;

Choose a reason for hiding this comment

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

On the next line, where you are using inventory[lastCar].car_make and inventory[lastCar].car_model, you're actually grabbing the first car in the list rather than the last. What can you do to let lastCar = 0 to get it to grab the last car in the array?

console.log();

let carModels = [];
for (i = 0; i < inventory.length; i++) {

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?

for (i = 0; i < inventory.length; i++) {
carModels.push(inventory[i].car_model);
}
carModels.sort();

Choose a reason for hiding this comment

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

You can also move the carModels.sort() into the next line like: console.log('Car models alphabetically: ', carModels.sort());

for (i = 0; i < inventory.length; i++) {
carYears.push(inventory[i].car_year);
}
console.log('list of car years: ' + carYears);

Choose a reason for hiding this comment

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

Nice job.

}
}

let BMWAndAudiStringified = JSON.stringify(BMWAndAudi);

Choose a reason for hiding this comment

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

Awesome! Great job.

// Give Kennan the ability to say "Hello, my name is Kennan!" Use the console.log provided as a hint.
// console.log(kennan.speak());

const kennanGreeting = 'Hello, my name is ' + intern1.name + '!';

Choose a reason for hiding this comment

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

Here you are declaring a variable and logging out the variable. You need to add the speak method to the intern1 object. How do you add a method to an object after the object has already been declared?

// Antonietta loves math, give her the ability to multiply two numbers together and return the product. Use the console.log provided as a hint.
//console.log(antonietta.multiplyNums(3,4));

function multiplyNums (x, y) {

Choose a reason for hiding this comment

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

The same for this exercise as the one above. You aren't adding multiplyNums to Antonietta's object. In the console.log where antonietta.multiplyNums... is, that is the hint showing multiplyNums should be attached to the antonietta object.

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