Skip to content

Mathias Bakken - #16

Closed
MatthiasBakken wants to merge 8 commits into
bloominstituteoftechnology:masterfrom
MatthiasBakken:master
Closed

Mathias Bakken#16
MatthiasBakken wants to merge 8 commits into
bloominstituteoftechnology:masterfrom
MatthiasBakken:master

Conversation

@MatthiasBakken

Copy link
Copy Markdown

No description provided.

Comment thread assignments/arrays.js
// ==== 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*` );
console.log(`Car 33 is a ${inventory[32].car_year} ${inventory[32].car_make} ${inventory[32].car_model}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Great job, doing this in place is the best way to approach this problem.

Comment thread assignments/arrays.js
let lastCar = 0;
console.log();
let lastCar = inventory[inventory.length - 1];
console.log(`${lastCar.car_make} ${lastCar.car_model}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using more descriptive console logs in the future, Like so:
console.log(`The last item in the list is a: ${lastCar.car_make} ${lastCar.car_model}`);

Comment thread assignments/arrays.js
oldCars.push(carYears[i])
}
}
console.log(oldCars.length);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit more descriptive console.log in order to identify the output later would be like this:
console.log('There is a total of: ', oldCars.length, ' cars older than the year 2000')

Comment thread assignments/arrays.js
BMWAndAudi.push(inventory[i]);
}
}
console.log(BMWAndAudi); No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Job using stringify and the II operator.
Perhaps utilizing some more of the stringify functionality a very nice list can be displayed.
console.log(JSON.stringify(BMWAndAudi, console.log('List of BMW and Audi Cars:'), '\t'));
On the code above I used the stringify function, and passed in a console.log to create a header, and used '\t' the tab character to separate each line with a tab.

Comment thread assignments/callbacks.js
@@ -2,27 +2,33 @@ const items = ['Pencil', 'Notebook', 'yo-yo', 'Gum'];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a very good understanding of callbacks 💯

Comment thread assignments/objects.js
// Give Kennan the ability to say "Hello, my name is Kennan!" Use the console.log provided as a hint.
// console.log(kennan.speak());
interns[1].speak = function () {
return "Hello my name is Kennan!";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Utilizing a bit more intricate method the keyword 'this' can be used to refer to the inter object also like so:
return ("Hello my name is " + this.name + "!");
Also we can make the speak function be in charge of console.log as well like so:

// Declaring a function to be used for every intern to speak.
function speak() {
    console.log('Hello my name is ' + this.name + '!');
}
interns[1].speak = speak;

// The same function can then be reused in for every other intern.
interns[2].speak = speak;
interns[3].speak = speak;
interns[4].speak = speak;
interns[5].speak = speak;

@mixelpixel mixelpixel closed this May 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants