Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 12 additions & 6 deletions assignments/arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let inventory = [{"id":1,"car_make":"Lincoln","car_model":"Navigator","car_year"
{"id":25,"car_make":"BMW","car_model":"525","car_year":2005},
{"id":26,"car_make":"Cadillac","car_model":"Escalade","car_year":2005},
{"id":27,"car_make":"Infiniti","car_model":"Q","car_year":2000},
{"id":28,"car_make":"Suzuki","car_model":"Aerio","car_year":2005},
{"id":28,"car_make":"Suzuki","car_model":"Aerio","car_year":2005},
{"id":29,"car_make":"Mercury","car_model":"Topaz","car_year":1993},
{"id":30,"car_make":"BMW","car_model":"6 Series","car_year":2010},
{"id":31,"car_make":"Pontiac","car_model":"GTO","car_year":1964},
Expand Down Expand Up @@ -63,17 +63,23 @@ let inventory = [{"id":1,"car_make":"Lincoln","car_model":"Navigator","car_year"

// ==== 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*` );
let filteredArray = inventory.filter(car => car.id === 33);


console.log(`Car 33 is a ${inventory[32].car_year} ${inventory[32].car_make} ${inventory[32].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 = 0;
console.log();
let lastCar = inventory.filter(car => car.id === 49);

console.log(`The last car on the inventory is a ${inventory[49].car_make} ${inventory[49].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
let carModels = [];
console.log();
let carModels = inventory.map(model =>{
return model.car_model
})
console.log(carModels.sort())

// ==== Challenge 4 ====
// 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.
Expand Down
42 changes: 21 additions & 21 deletions assignments/function-conversion.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
// Take the commented ES5 syntax and convert it to ES6 arrow Syntax

// let myFunction = function () {
// console.log("Function was invoked!");
// };
// myFunction();
const myFunction = (a,b) => {
return ("Function was invoked");
};
console.log(myFunction())

// let anotherFunction = function (param) {
// return param;
// };
// anotherFunction("Example");
const anotherFunction = (param) => {
return param;
};
console.log(anotherFunction("Example"))

// let add = function (param1, param2) {
// return param1 + param2;
// };
// add(1,2);
const add = (param1, param2) => {
return param1 + param2;
};
console.log(add(1,2))

// let subtract = function (param1, param2) {
// return param1 - param2;
// };
// subtract(1,2);
const subtract = (param1, param2) => {
return param1 - param2;
};
console.log(subtract(1,2))


// Stretch

// exampleArray = [1,2,3,4];
// const triple = exampleArray.map(function (num) {
// return num * 3;
// });
// console.log(triple);
exampleArray = [1,2,3,4];
const triple = exampleArray.map(function (num) {
return num * 3;
});
console.log(triple);
74 changes: 71 additions & 3 deletions assignments/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,94 @@ const example = {

// Write your intern objects here:

const intern_one= {
"id": 0,
"name": "Mitzi",
"email": "kdiben1@tinypic.com",
"gender": "M"
}

const intern_two = {
"id": 1,
"name": "Kennan",
"email": "examples@you.edu",
"gender": "M",
speak:function(name){
console.log(`Hello, my name is " ${name} !`)
}
}
const kennan = {
"id": 1,
"name": "Kennan",
"email": "examples@you.edu",
"gender": "M",
speak:function(name){
console.log(`Hello, my name is ${this.name} !`)
}
}

const intern_three = {
"id": 2,
"name": "keven",
"email": "kmummery2@wikimedia.org",
"gender": "M"
}

const intern_four = {
"id": 3,
"name": "Gannie",
"email": "gmartinson3@illinois.edu",
"gender": "M"
}

const intern_five = {
"id": 4,
"name": "Antonietta",
"email": "adaine5@samsung.com",
"gender": "F",
multiplyNums:function(a,b){
return a * b
}
}
const antonietta = {
"id": 4,
"name": "Antonietta",
"email": "adaine5@samsung.com",
"gender": "F",
multiplyNums:function(a,b){
return a * b
}
}





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

// Mitzi's name
console.log(intern_one.name);

// Kennan's ID
console.log(intern_two.id);

// Keven's email

console.log(intern_three.email);
// Gannie's name
console.log(intern_four.name);

// Antonietta's Gender

console.log(intern_five.gender);


// ==== Challenge 3: Object Methods ====
// Give Kennan the ability to say "Hello, my name is Kennan!" Use the console.log provided as a hint.
// console.log(kennan.speak());
console.log(kennan.speak());

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

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

Expand Down