­

Javascript Closure Explained

Tuesday, November 29, 2016
When we create the JavaScript function within another function and the inner function can access to all the variable of outer function. How to create closure in javascript Example 1: function outerFunction(a) { var intial = 5; function innerFunction(b) { console.log(a + b + (++intial)); // It will return the 20. } innerFunction(10); } outerFunction(4); // Pass an argument 4 Output is 20...

Read More...