Does a parameter variable create closure in JavaScript? -


i tasked trace cause of memory leak in 1 of our applications i'm trying study closures. wonder if code creates closure:

function foo(p) {     return function(){ return p + 1; } } 

based on understanding, closure created when inner function gains access local variable of parent function. parameter p local foo, if inner function gains access p, mean closure created?

the parameters of function exists in local scope of function, yes creates closure


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -