>
> What about the scope? I am using the var's as a method of keeping the
> functions from polluting the global scope.
>
> If they pollute the global scope I won't be able to use the same naming
> convention (cb1,cb2,cb3...) in my other event handlers.
>

http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting

Is a closure the right solution for the subfunction scoping problem? In
other words: will the code below interferer over closures or work as
expected?


(function () {

  new Request(data,cb1);

  function cb1(){
     //some code
     new Request(data,cb2);
  }

  function cb2(){
     //some code
  }

}());


(function () {

  new Request(data2,cb1);

  function cb1(){
     //other code
     new Request(data2,cb2);
  }

  function cb2(){
     //other code
  }

}());

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to