Exploring closures: scope chain

by Cristi Salcescu

JavaScript

let x0 = 0;
(function autorun1(){
	let x1 = 1;
  
	(function autorun2(){
  	let x2 = 2;
  
  	(function autorun3(){
    	let x3 = 3;
      
    	console.log(x0 + " " + x1 + " " + x2 + " " + x3);
    })();
  })();
})();