Understanding Closure Functions in JavaScript: Examples and Explanation
A closure is a function having access to the parent scope. Closure means that an inner function always have access to the vars and parameters of it outer function even after the outer function…