Impress Front-End Interviewer — Closure

Table Of Content

table of content

1. What is Closure:

1.1 Closure Definition:

1.2 Where does Closure Comes From

a brief history of closure
three programming paradigm

2. Closure Common Scenarios:

2.1 Nested Function

nested function

2.2 Private Member Accessibility

2.3 IIFE(mock block scope)

IIFE + Closure solution
Block Scope Solution

2.4 Callback

From You don’t know js Yet Chapter 7

2.5 Event Handler

event handler + closure

3. Closure Interview Questions

example 1
example 2
Photo by Brett Garwood on Unsplash

4. Conclusion:

5. Reference:

6. Further Reading:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store