Difficulty: 5/10state encapsulation, event handling, module patternHere are some use cases of closures in JavaScript:1Currying2Partial Function3Memoisation4Data encapsulation/ Data Privacy5Event Handlers6Function Factories7Iterator8Callback FunctionsScenario Questions0-2 years experience1How would you use a closure to create a simple counter function that increments each time it's called?2If you write a function that returns another function capturing a variable, what will be logged when you call the inner function after the outer function has finished?3Can you show how a closure can keep a variable private inside an object literal?Follow-up QuestionsWhat would happen if you removed the IIFE wrapper?How does using a closure impact unit testing and mocking?Can you identify any performance or memory drawbacks in a high‑traffic scenario?Suggest Improvement