Skip to content

Commit 1193179

Browse files
Merge pull request #1 from Manny-Rocks/emmanuel-tanifum
Emmanuel tanifum
2 parents 86fe720 + 3b4d89b commit 1193179

3 files changed

Lines changed: 104 additions & 30 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/function-conversion.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
// Take the commented ES5 syntax and convert it to ES6 arrow Syntax
22

3-
// let myFunction = function () {
4-
// console.log("Function was invoked!");
5-
// };
6-
// myFunction();
3+
const myFunction = (a,b) => {
4+
return ("Function was invoked");
5+
};
6+
console.log(myFunction())
77

8-
// let anotherFunction = function (param) {
9-
// return param;
10-
// };
11-
// anotherFunction("Example");
8+
const anotherFunction = (param) => {
9+
return param;
10+
};
11+
console.log(anotherFunction("Example"))
1212

13-
// let add = function (param1, param2) {
14-
// return param1 + param2;
15-
// };
16-
// add(1,2);
13+
const add = (param1, param2) => {
14+
return param1 + param2;
15+
};
16+
console.log(add(1,2))
1717

18-
// let subtract = function (param1, param2) {
19-
// return param1 - param2;
20-
// };
21-
// subtract(1,2);
18+
const subtract = (param1, param2) => {
19+
return param1 - param2;
20+
};
21+
console.log(subtract(1,2))
2222

2323

2424
// Stretch
2525

26-
// exampleArray = [1,2,3,4];
27-
// const triple = exampleArray.map(function (num) {
28-
// return num * 3;
29-
// });
30-
// console.log(triple);
26+
exampleArray = [1,2,3,4];
27+
const triple = exampleArray.map(function (num) {
28+
return num * 3;
29+
});
30+
console.log(triple);

assignments/objects.js

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,94 @@ const example = {
1919

2020
// Write your intern objects here:
2121

22+
const intern_one= {
23+
"id": 0,
24+
"name": "Mitzi",
25+
"email": "[email protected]",
26+
"gender": "M"
27+
}
28+
29+
const intern_two = {
30+
"id": 1,
31+
"name": "Kennan",
32+
"email": "[email protected]",
33+
"gender": "M",
34+
speak:function(name){
35+
console.log(`Hello, my name is " ${name} !`)
36+
}
37+
}
38+
const kennan = {
39+
"id": 1,
40+
"name": "Kennan",
41+
"email": "[email protected]",
42+
"gender": "M",
43+
speak:function(name){
44+
console.log(`Hello, my name is ${this.name} !`)
45+
}
46+
}
47+
48+
const intern_three = {
49+
"id": 2,
50+
"name": "keven",
51+
"email": "[email protected]",
52+
"gender": "M"
53+
}
54+
55+
const intern_four = {
56+
"id": 3,
57+
"name": "Gannie",
58+
"email": "[email protected]",
59+
"gender": "M"
60+
}
61+
62+
const intern_five = {
63+
"id": 4,
64+
"name": "Antonietta",
65+
"email": "[email protected]",
66+
"gender": "F",
67+
multiplyNums:function(a,b){
68+
return a * b
69+
}
70+
}
71+
const antonietta = {
72+
"id": 4,
73+
"name": "Antonietta",
74+
"email": "[email protected]",
75+
"gender": "F",
76+
multiplyNums:function(a,b){
77+
return a * b
78+
}
79+
}
80+
81+
82+
83+
2284

2385
// ==== Challenge 2: Reading Object Data ====
2486
// Once your objects are created, log out the following requests from HR into the console:
2587

2688
// Mitzi's name
89+
console.log(intern_one.name);
2790

2891
// Kennan's ID
92+
console.log(intern_two.id);
2993

3094
// Keven's email
31-
95+
console.log(intern_three.email);
3296
// Gannie's name
97+
console.log(intern_four.name);
3398

3499
// Antonietta's Gender
35100

101+
console.log(intern_five.gender);
102+
103+
36104
// ==== Challenge 3: Object Methods ====
37105
// Give Kennan the ability to say "Hello, my name is Kennan!" Use the console.log provided as a hint.
38-
// console.log(kennan.speak());
106+
console.log(kennan.speak());
39107

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

43111
// === Great work! === Head over to the the arrays.js file or take a look at the stretch challenge
44112

0 commit comments

Comments
 (0)