0

why would one have to pass undefined as an argument in the below referenced function

 var x = (function (window, undefined){
      function x(){
        this. result = 0;
      }
  })(window);
user3873833
  • 45
  • 1
  • 4
  • I think that is a bad idea taking *keyword* as parameter name. – Mritunjay Aug 14 '14 at 06:08
  • possible duplicate of [How does this JavaScript/JQuery Syntax work: (function( window, undefined ) { })(window)?](http://stackoverflow.com/questions/2716069/how-does-this-javascript-jquery-syntax-work-function-window-undefined) – go-oleg Aug 14 '14 at 06:12
  • 2
    @Mritunjay: undefined isn't a keyword, its a variable. – go-oleg Aug 14 '14 at 06:13

1 Answers1

0

To make sure undefined references undefined and nothing else.

praty
  • 914
  • 9
  • 11