You have a robot kit.
Inside the kit, you an instruction guide and some materials to build the robot, such as screws, metal frames, and a motherboard.
The instruction guide tells you how to use the kit's material to build the robot. But the instruction guide also notes that you need some things that are not included in the kit such as, batteries and a computer, to get the robot up and running.
You follow the kit's instruction guide, use the kit's materials and the not included materials to build a cool robot.
In this case: the closure is the whole robot kit (instruction guide and included materials) + not included materials.
So a closure is a function object (code and variables declared in function ) + references variables that are used in the function's code but were declared outside the function
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.