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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -