Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions assignments/arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ let inventory = [

// ==== 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:

let car33 = inventory.find(car => car.id === 33);
console.log(
`Car 33 is a ${inventory[32].car_year} ${inventory[32].car_make} ${
inventory[32].car_model
}.`
`Car 33 is a ${car33.car_year} ${car33.car_make} ${car33.car_model}.`
);

// ==== 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 = inventory[inventory.length - 1];
console.log(`The last car is a ${lastCar.car_make} ${lastCar.car_model}`);
console.log(`The last car is a ${lastCar.car_make} ${lastCar.car_model}.`);

// ==== Challenge 3 ====
// 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
Expand Down