flâneur — a map of the web's best reading

What the fuck is a closure? ・ Dan’s JavaScript Glossary

whatthefuck.is · 1,818 words · saved by 1 readers

Dan’s JavaScript Glossary

Closures are confusing because they are an “invisible” concept. When you use an object, a variable, or a function, you do this intentionally. You think: “I’m gonna need a variable here,” and add it to your code. Closures are different. By the time most people approach closures, they have already used them unknowingly many times — and it is likely that this is true for yourself, too. So learning closures is less about understanding a new concept and more about recognizing something you have already been doing for a while. tl;dr You have a closure when a function accesses variables defined outsi

Explore this link on the map →

saved by

related reading