var x = 6;
var y = 4;
var a = function(b) {
return function(c) {
return y + b + c;
}
};
x = 2;
y = 5; // unnecessary, meant to confuse
var fn = a(x); // creates a closure, where b equals 2
x = 1; // unnecessary, meant to confuse
y = 3;
var unknown = 5;
console.log(fn(unknown)); // y=3,b=2,c=5, total = 10
1
solved I don’t understand this Javascript?