Skip to content

Aislynn edmiston - #1

Open
AislynnEdmiston wants to merge 4 commits into
masterfrom
aislynn-edmiston
Open

Aislynn edmiston#1
AislynnEdmiston wants to merge 4 commits into
masterfrom
aislynn-edmiston

Conversation

@AislynnEdmiston

Copy link
Copy Markdown
Owner

No description provided.

@AislynnEdmiston
AislynnEdmiston requested a review from lolax February 2, 2019 18:58

@lolax lolax left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great work, Aislynn!

// 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.forEach(function firstAndLastName(element) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd recommend naming "element" what it is so the code is more semantic. In this case, each element is a "runner." Similarly, your variable "i" could be called "names" so that the logic is a bit easier to follow. Typically, "i" refers to an index.

ticketPriceTotal.push(runner.donation);
})

console.log(ticketPriceTotal.reduce(function (pv, cv, ci, arr){

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work!

})

// Problem 3 No newline at end of file
console.log(sorted.sort()); No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work on these three problems!

Comment thread assignments/callbacks.js
return cb(arr.length);
}

getLength(items, function(first){

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The naming of the argument "first" is a bit confusing here.

Comment thread assignments/callbacks.js

function last(arr, cb) {
// last passes the last item of the array into the callback.
return cb(arr.slice(-1).pop());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice! You can also use arr[arr.length-1]

Comment thread assignments/callbacks.js
return cb (list.includes(item));
}

contains( 'rock', items, console.log);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice work on all these callbacks!

Comment thread assignments/closure.js
// ==== Challenge 1: Write your own closure ====
// Write a simple closure of your own creation. Keep it simple!

function dateOfBirth(month, day, year){

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a great start. I noticed your console.log is a bit off and you're not using myBirth, though. Here's how it looks with those fixed:

function dateOfBirth(month, day, year){
  const myBirth = "The date of my birth is:";

  function myBirthday (){
    return `${myBirth} ${month} ${day}, ${year}`;
  }

  return myBirthday();
}

console.log(dateOfBirth("May", "15", '1993'));

Comment thread assignments/closure.js
const counter = () => {
// Return a function that when invoked increments and returns a counter variable.
let count = 0;
return () => (++count);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Very sleek ES6!

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