Skip to content

Commit e2d8a70

Browse files
committed
Created intern objects one through five and logged out different requests fro HR into the console
1 parent 86fe720 commit e2d8a70

2 files changed

Lines changed: 56 additions & 7 deletions

File tree

‎assignments/arrays.js‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let inventory = [{"id":1,"car_make":"Lincoln","car_model":"Navigator","car_year"
2929
{"id":25,"car_make":"BMW","car_model":"525","car_year":2005},
3030
{"id":26,"car_make":"Cadillac","car_model":"Escalade","car_year":2005},
3131
{"id":27,"car_make":"Infiniti","car_model":"Q","car_year":2000},
32-
{"id":28,"car_make":"Suzuki","car_model":"Aerio","car_year":2005},
32+
{"id":28,"car_make":"Suzuki","car_model":"Aerio","car_year":2005},
3333
{"id":29,"car_make":"Mercury","car_model":"Topaz","car_year":1993},
3434
{"id":30,"car_make":"BMW","car_model":"6 Series","car_year":2010},
3535
{"id":31,"car_make":"Pontiac","car_model":"GTO","car_year":1964},
@@ -63,17 +63,23 @@ let inventory = [{"id":1,"car_make":"Lincoln","car_model":"Navigator","car_year"
6363

6464
// ==== Challenge 1 ====
6565
// 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:
66-
console.log(`Car 33 is a *car year goes here* *car make goes here* *car model goes here*` );
66+
let filteredArray = inventory.filter(car => car.id === 33);
67+
68+
69+
console.log(`Car 33 is a ${inventory[32].car_year} ${inventory[32].car_make} ${inventory[32].car_model}` );
6770

6871
// ==== Challenge 2 ====
6972
// 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.
70-
let lastCar = 0;
71-
console.log();
73+
let lastCar = inventory.filter(car => car.id === 49);
74+
75+
console.log(`The last car on the inventory is a ${inventory[49].car_make} ${inventory[49].car_model}`);
7276

7377
// ==== Challenge 3 ====
7478
// 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
75-
let carModels = [];
76-
console.log();
79+
let carModels = inventory.map(model =>{
80+
return model.car_model
81+
})
82+
console.log(carModels.sort())
7783

7884
// ==== Challenge 4 ====
7985
// The accounting team needs all the years from every car on the lot. Create a new array from the dealer data containing only the car years and log the result in the console.

‎assignments/objects.js‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,63 @@ const example = {
1919

2020
// Write your intern objects here:
2121

22+
const intern_one= {
23+
"id": 0,
24+
"name": "Mitzi",
25+
"email": "kdiben1@tinypic.com",
26+
"gender": "M"
27+
}
28+
29+
const intern_two = {
30+
"id": 1,
31+
"name": "Kennan",
32+
"email": "examples@you.edu",
33+
"gender": "M"
34+
}
35+
36+
const intern_three = {
37+
"id": 2,
38+
"name": "keven",
39+
"email": "kmummery2@wikimedia.org",
40+
"gender": "M"
41+
}
42+
43+
const intern_four = {
44+
"id": 3,
45+
"name": "Gannie",
46+
"email": "gmartinson3@illinois.edu",
47+
"gender": "M"
48+
}
49+
50+
const intern_five = {
51+
"id": 4,
52+
"name": "Antonietta",
53+
"email": "adaine5@samsung.com",
54+
"gender": "F"
55+
}
56+
57+
58+
2259

2360
// ==== Challenge 2: Reading Object Data ====
2461
// Once your objects are created, log out the following requests from HR into the console:
2562

2663
// Mitzi's name
64+
console.log(intern_one.name);
2765

2866
// Kennan's ID
67+
console.log(intern_two.id);
2968

3069
// Keven's email
31-
70+
console.log(intern_three.email);
3271
// Gannie's name
72+
console.log(intern_four.name);
3373

3474
// Antonietta's Gender
3575

76+
console.log(intern_five.gender);
77+
78+
3679
// ==== Challenge 3: Object Methods ====
3780
// Give Kennan the ability to say "Hello, my name is Kennan!" Use the console.log provided as a hint.
3881
// console.log(kennan.speak());

0 commit comments

Comments
 (0)