Skip to content

codeByCandlelight/closures-mini-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Closures Mini-Workshop (Student Repo)

Duration: 90 minutes (in-workshop exercises)
Focus: Using closures to persist state across calls, guided by APS (Approach to Problem Solving).

Problems

You will work through three problems in problems/:

  1. addByX.js (APS review)
  2. callTimes.js (pairs)
  3. saveOutput.js (trios)

Each file contains:

  • A student-facing prompt at the top
  • A starter function
  • An optional runTests() function that you can uncomment locally

Tip: Use the APS steps as you work (Define success → Explore key phrases → Match actions → Redefine if needed → Create strategy).

Getting Started

  1. Codespaces or local: open the repo in VS Code.
  2. Open a problem file in problems/.
  3. Fill in the function body.
  4. Uncomment the runTests() call at the bottom to try your solution.

Stretch Ideas

  • Combine adders from addByX: Write a function that takes two addByX functions (like addByTwo and addByThree) and returns a new function that adds both amounts.
  • Make callTimes resettable: Add functionality to reset the counter back to zero.
  • Extend saveOutput: Support functions that take multiple arguments.

Workshop Expectation: For each problem, run the minimal examples provided, then add ONE of your own test call(s) to validate your solution (edge case or independent instance). Keep it short — you have ~20 minutes per challenge.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published