Skip to content

Ray Lomeli JS2 - #221

Open
raylom wants to merge 2 commits into
bloominstituteoftechnology:masterfrom
raylom:master
Open

Ray Lomeli JS2#221
raylom wants to merge 2 commits into
bloominstituteoftechnology:masterfrom
raylom:master

Conversation

@raylom

@raylom raylom commented Aug 7, 2018

Copy link
Copy Markdown

@kait-schorr

Copy link
Copy Markdown

Objectives

  • Student should be able to describe what closure is, how closure is created in a program and why it is important to have different types of scope
  • Student should be able to demonstrate the proper use a of a callback function by passing a function to another function as a parameter
  • Student should be able to demonstrate ability to use .map .reduce .filter and describe their use cases

Great

  • The array-methods exercises look great!
  • Your code is well structured.

Requested Improvements

  • Try to commit more frequently and with meaningful messages
  • The assignment is incomplete. You still need to do the following:
    • Challenge 5 in arrays, Write your own questions and solve them!
    • Finish the callbacks exercises
  • Be sure you understand ES6 syntax and use it as frequently as possible (let, const, arrow functions, etc)
  • Challenge 2 in the closure exercise is incorrectly implemented. Refer to the solution code and the line by line comments for clarification.

Questions

  • What is the advantage of using ForEach or built-in array methods over for loops? The disadvantage?

Rating: {1-3}

Incomplete

Comment thread assignments/closure.js
add();
add();
add();
// Example usage: const newCounter = counter();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In order to create a closure you need to save the function in another variable. For example:

const newCounter = add();
console.log(newCounter()) // 1
console.log(newCounter()) // 2
console.log(newCounter()) // 3
console.log(newCounter()) // 4
console.log(newCounter()) // 5

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