Skip to content

Sofia levin: Stretch - #1

Merged
AsaOfDiamonds merged 14 commits into
masterfrom
sofia-levin
May 30, 2019
Merged

AsaOfDiamonds merged 14 commits into
masterfrom
sofia-levin

Conversation

@sofialevin

Copy link
Copy Markdown
Owner

No description provided.

@sofialevin
sofialevin requested a review from AsaOfDiamonds May 23, 2019 02:17
Comment thread assignments/arrays.js
// ==== Challenge 1 ====
// 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*` );

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

great job using a for loop, for this exercise you could have skipped the looping since you know the id.
so you could have done something like this only using a console.log
console.log(Car 33 is a ${inventory[32].car_year} ${inventory[32].car_make} ${inventory[32].car_model} );

Comment thread assignments/arrays.js
console.log();
lastCar = inventory[inventory.length - 1];
console.log(lastCar.car_make + ' ' + lastCar.car_model + '.');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I highly recommend using template literals in the future instead of + ' ' +
it would look something like this
console.log(lastCar.car_make lastCar.car_model)
let me know if you want more information on string template literals

Comment thread assignments/arrays.js
console.log();

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this could also be written like this
carModels.push(inventory[i].car_model);

Comment thread assignments/objects.js
"email": "mmelloy0@psu.edu",
"gender": "F"
}

Copy link
Copy Markdown
Collaborator

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 and then I will show you the console.log at the end
let mitzi = {
"id": 1,
"name": "Mitzi",
"email": "mmelloy0@psu.edu",
"gender": "F"
}

Comment thread assignments/objects.js
// Mitzi's name

console.log(student1.name);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

console.log(mitzi.name);

@AsaOfDiamonds AsaOfDiamonds left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great job on your project, I made a few comments in your code with alternative ways to write.

@AsaOfDiamonds
AsaOfDiamonds merged commit 9cec4d9 into master May 30, 2019
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