IIFE

IIFE

Hi,

I am new to jQuery. Can some one explain me the following code? Especially why 
call to function message() second time also produces 42?

Thanks
  Soundararajan

  1. var x = 42;
  2. console.log(x);
  3. var message = (
  4.     function(x){
  5.      return function(){
  6.          console.log("x is " + x);
  7.      }   
  8.     }
  9. )(x);
  10. message();
  11. x = 12;

  12. console.log(x);
  13. message();
//***********************************

42

x is 42

12

x is 42