Here is some code I'm really having issues understanding (JavaScript)
function func(x) {
     var y = x + 2;
     z = 20;
     return function(y) {
         var z = y * 3; 
         return function(z) {
             return x + y + z;
         };
     }; 
 }
 console.log(func(3)(4)("z"));
output: 7z
I have a lot of experience with Java (only Java) and I'm really having issues understanding how JavaScript works. I tried debugging and going step by step over code but I'm still very confused.
One sub-question I have is whether y on line 2 is the same y as in
return function(y) line.
Any help would be greatly appreciated!
 
     
     
     
     
    