Lingkup Params di JavaScript

var x = 1;
 
function foo(y = function() { return x; }) { // capture `x`
  var x = 2;
  return y();
}
 
foo(); // correctly 1, not 2
Funny Name