Repository navigation
Sofia levin: Stretch - #1
Conversation
| // ==== 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*` ); | ||
|
|
There was a problem hiding this comment.
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} );
| console.log(); | ||
| lastCar = inventory[inventory.length - 1]; | ||
| console.log(lastCar.car_make + ' ' + lastCar.car_model + '.'); | ||
|
|
There was a problem hiding this comment.
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
| console.log(); | ||
|
|
||
| for (let i = 0; i < inventory.length; i++) { | ||
| carModels.push(inventory[i]['car_model']); |
There was a problem hiding this comment.
this could also be written like this
carModels.push(inventory[i].car_model);
| "email": "mmelloy0@psu.edu", | ||
| "gender": "F" | ||
| } | ||
|
|
There was a problem hiding this comment.
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"
}
| // Mitzi's name | ||
|
|
||
| console.log(student1.name); | ||
|
|
There was a problem hiding this comment.
console.log(mitzi.name);
AsaOfDiamonds
left a comment
There was a problem hiding this comment.
Great job on your project, I made a few comments in your code with alternative ways to write.
No description provided.