Skip to content

Latest commit

 

History

History
30 lines (15 loc) · 1.06 KB

File metadata and controls

30 lines (15 loc) · 1.06 KB

Implement Closures

In this activity you will work on this user story:

  • As a developer, I want to demonstrate my knowledge of closures by creating a makeCountDown function that accesses the surrounding function state.

Your Task

  • It's done when I have created a function makeCountDown that returns a nested function.

  • It's done when I have set the return value of countDown to a variable called countingDown.

  • It's done when invoking the countingDown for the first time will start a countdown from startingNum.

  • It's done when every subsequent invocation of countDown returns the startingNum subtracted from the decreasedBy variable.

Notes

Hints

  • How can we use the comments inside index.js to guide us in what our inner function should return?

  • What kind of function is one that creates other functions?

Bonus

  • Using Google, what are some complications you might run into when using closures within for loops?