declaring a variable twice in IIFE
I came through this fun quiz on the internet. console.log((function(x, f = (() => x)){ var x; var y = x; x = 2; return [x, y, f()] })(1)) and the choices were: [2,1,1] [2, undefined, 1] [2, 1, 2] [2, undefined, 2] I picked solution 2 TBH, basing that on that x has been redefined, y was declared and defined with no value, and that f has a different scope hence getting the global x memory spot than function x memory spot. However, I tried it in jsbin.com and I found it was solution 1, while I was not sure why that happened I messed with the function body and I removed var x from the function