Skip to content

Javascript II - Completed objectives and stretch goals.#197

Open
ThomasKisner wants to merge 1 commit intobloominstituteoftechnology:masterfrom
ThomasKisner:master
Open

Javascript II - Completed objectives and stretch goals.#197
ThomasKisner wants to merge 1 commit intobloominstituteoftechnology:masterfrom
ThomasKisner:master

Conversation

@ThomasKisner
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@zackhitch zackhitch left a comment

Choose a reason for hiding this comment

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

Great job with this! The function conversion project will be good practice with more arrow functions, which we'll use mostly moving forward.

// The event director needs both the first and last names of each runner for their running bibs. Combine both the first and last names into a new array called fullName.
let fullName = [];

runners.map(function(element){
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 were to use a .forEach here...

// ==== Challenge 2: Use .map() ====
// The event director needs to have all the runner's first names converted to uppercase because the director BECAME DRUNK WITH POWER. Convert each first name into all caps and log the result
let allCaps = [];
let allCaps = runners.map(function(element){
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

// The large shirts won't be available for the event due to an ordering issue. Get a list of runners with large sized shirts so they can choose a different size. Return an array named largeShirts that contains information about the runners that have a shirt size of L and log the result
let largeShirts = [];
console.log(largeShirts);
let largeShirts = runners.filter((size) => {
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! This is all that was needed, but good job putting in some extra practice! 😉

// ==== Challenge 4: Use .reduce() ====
// The donations need to be tallied up and reported for tax purposes. Add up all the donations into a ticketPriceTotal array and log the result
let ticketPriceTotal = [];
ticketPriceTotal = runners.reduce((donation, runner, index, runners) => {
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 here as well. You can remove index and runners, as those are optional parameters, and since they are not used, they shouldn't be there.

// Now that you have used .forEach(), .map(), .filter(), and .reduce(). I want you to think of potential problems you could solve given the data set and the 5k fun run theme. Try to solve 3 unique problems using one or many of the array methods listed above.

// Problem 1
const bigDonors = runners.filter((runner)=>{
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💪

@@ -2,33 +2,89 @@ 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.

Great work!


function world() {
const second = "world";
console.log(`${first} ${second}`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💯

// ==== Challenge 2: Create a counter function ====
const counter = () => {
// Return a function that when invoked increments and returns a counter variable.
let numberCount = 0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

2 participants