DEV Community

Discussion on: 3 topics in 1 JavaScript interview question

Collapse
 
slatham profile image
Steve Latham

The backpack analogy is a good one. I often think the names given to these concepts make them harder to learn. Closures to me would indicate some kind of ending or return. I assume it is something to do with being enclosed, maybe? Similarly the "rest parameter" sounds like it's going to have a little pause before entering your function. I had a less imaginative way to remember closures - savedScopeForLater! From now on though, Closure = backpack!

Great article, Maciek!