Giter Site home page Giter Site logo

js-closures's Introduction

JS-Closures

Objective

Better understand Javascript closures by completing a series of activities

Directions

Fork this repo, clone your fork, then open closures.js and complete all the activities. COMMIT AND PUSH YOUR CODE OFTEN!

Debugging/Visualization tools :

One of the biggest tools in a developers disposal is the debugger. Chrome has one built-in. To use it, just open the index.html file in your browser.

Another great tool for small and isolated pieces of code is : http://www.pythontutor.com/visualize.html#

Contributions

If you see a problem or a typo, please fork, make the necessary changes, and create a pull request so we can review your changes and merge them into the master repo and branch.

Copyright

© DevMountain LLC, 2015. Unauthorized use and/or duplication of this material without express and written permission from DevMountain, LLC is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to DevMountain with appropriate and specific direction to the original content.

js-closures's People

Contributors

asbrettisay avatar bencallis1 avatar brackcarmony avatar brianjhudson avatar cahlan avatar dallin-r-parker avatar devlemire avatar gunn4r avatar jasondawson avatar joeh8rs avatar joseph-tohdjojo avatar joshualeduc avatar jrobber avatar mckmillions avatar mikkelrd avatar r-walsh avatar tylermcginnis avatar yurovant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-closures's Issues

Problem 6 (privateMethod, publicMethod) needs clarification

@jrobber Probably something like this:

/* Inside the return object create a publicMethod property that is a function that
invokes privateMethod and returns the value you get from invoking it. After you 
create the privateMethod, invoke it by calling module.publicMethod(); outside 
the module scope */

Problem 7 (second to last one; i.e. the setTimeout one) needs better instructions

@jrobber While it is helpful to have the newScope function there as a hint, the vast majority of students still need hand-holding all the way through this one, myself included when I first encountered it. Maybe we should go as far as to point out that the anonymous function definition we are passing in on lines 203-205 is no sufficient and we need to harness a return value from newScope (which would have its own fixed closure) to get this to work.

Problem 8 needs removal or instructions need clarification

The line
*Hint: Don't let this fool you. Break down what's really happening here.
Should read something like:
*Hint: Don't let this fool you. Break down what's really happening here. The length of the array is 6 (i.e. it's not infinite).

Problem 4 (counterFactory) should we have example returns after like the previous problem?

@jrobber These instructions refer to the "module pattern" but don't really explain what that means. Furthermore, that is a vague term. A student also pointed out that in programming you usually know what you want the outcome to be and you use your tools to get there, so he would have appreciated example return values on this one just like the previous one, like so:

var counter = counterFactory(10);
counter.inc(); // 11
counter.dec(); // 10
counter.dec(); // 9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.