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

mysqli - Php Mysqli_fetch_assoc Error : "Warning: Illegal string offset 'name' in" -

html - Cut text on left side inside button while centering -

php - Hide Categories from WordPress Dashboard by ID and Custom Post Type -