Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Added REVIEW Week 7 content #17

Merged
merged 2 commits into from
Oct 31, 2017
Merged

Added REVIEW Week 7 content #17

merged 2 commits into from
Oct 31, 2017

Conversation

remarcmij
Copy link
Contributor

Discussion of map, filter and reduce.

Copy link
Member

@mkruijt mkruijt left a comment

Choose a reason for hiding this comment

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

Hi Jim, looks really good. For me the coding examples work better if you have a bit more context, something like, (step 6) https://github.com/HackYourFuture/JavaScript/blob/master/Week7/MAKEME.md . Also can you make sure that at the top there is a list that tells what is in the document?

Week7/REVIEW.md Outdated

Copy link
Member

Choose a reason for hiding this comment

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

Hi Jim, can we keep this list at the top?

Week7/REVIEW.md Outdated
@@ -1,9 +1,196 @@
# REVIEW JavaScript week 7

## Git Workflow

To be provided
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

the workflow is explained there

### Array#filter

The **filter()** method returns a new array with all elements that pass the test implemented by a user-supplied (predicate\*) function.

Copy link
Member

Choose a reason for hiding this comment

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

maybe you can describe a bit more what the function below does, (in a simpler way)

### Array#map\*

The **map** method returns a new array where each element of the subject array is transformed by a user-supplied transformation (= _mapping_) function.

Copy link
Member

Choose a reason for hiding this comment

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

maybe you can describe a bit more what the function below does, (in a simpler way) and with a real life example, something people can actually relate to

const numbers = [3, 5, 2, 7];
const squares = numbers.map(num => num * num);
console.log(squares); // -> [9, 25, 4, 49]
```
Copy link
Member

Choose a reason for hiding this comment

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

I like that you say, "here we do the same using the map/filter/reduce method"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you want me to do here...

Copy link
Member

Choose a reason for hiding this comment

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

nothing, it was a compliment!

> The reduce() method applies a function against an accumulator and each element in the array (from left to right) to reduce it to a single value\*\*.

<small>\*\*Although reference is made to a 'single value', this single value may well be an array or an object, as you will see later in the examples below.</small>

Copy link
Member

Choose a reason for hiding this comment

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

same comment as above. It would be nice if the coding examples have a bit more context. explanation

Copy link
Member

@mkruijt mkruijt left a comment

Choose a reason for hiding this comment

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

Thank you for the changes!

const numbers = [3, 5, 2, 7];
const squares = numbers.map(num => num * num);
console.log(squares); // -> [9, 25, 4, 49]
```
Copy link
Member

Choose a reason for hiding this comment

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

nothing, it was a compliment!

@mkruijt mkruijt merged commit c0370a6 into HackYourFuture:master Oct 31, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants