function Increment()
{
var counter = 100;
function inner()
{
counter += counter;
return counter;
}
}
var x = Increment();
console.log(x);
console.log(x);
console.log(x);
This is instruction of this code Use JavaScript Closure/self invoking method to do the following: a)Name the outer function as ‘Increment”. b)Store 100 as a counterin the outer function. c)Increment the counter by 100 in the inner functionand return. d)Call “Increment” three times and store the returned value in a variable each time. e)Log the final value in the web console (400 is the final valuefor the third call) , but function does not return even the first value.
Can you guys see where the problem is?