Nervous about being asked about closures or IIFEs at a job interview?
Don't be nervous, be practiced! With these 6 Closure Problems.
Closures and IIFEs are TRICKY.
Instead of reading about them once, you can quiz yourself over and over again with this problem set.
Currently, it focuses on IIFE applications, but more may be added soon. (Contributions welcome!)
Copy all the problems from main.js into your IDE with a good terminal OR a tool like Javascript Replit
Then, one problem at a time - make a prediction on WHAT you think will be logged by the function.
After you make a prediction, comment out the function call, and run the code!
If your prediction was correct - great! Next problem.
If your prediction was incorrect - STOP, learn more about closures, and don't continue until you are able to explain WHY the code does what does.
Do you have some Closure problems that are unaddressed by this problem set?
Please make a Pull Request and I'll be happy to add :)
Shoutout to Jacob Ward for the seventh question in the list. Tricky! https://jacobward.io/post/presenting-javascript-interview-question/