Javascript: Inline function vs predefined functions

Posted by glaz666 on Stack Overflow See other posts from Stack Overflow or by glaz666
Published on 2010-03-29T15:38:20Z Indexed on 2010/03/29 15:43 UTC
Read the original article Hit count: 284

Filed under:
|

Can any body throw me some arguments for using inline functions against passing predefined function name to some handler.

I.e. which is better:

(function(){
  setTimeout(function(){ /*some code here*/ }, 5);
})();

versus

(function(){
  function invokeMe() {
    /*code*/
  }
  setTimeout(invokeMe, 5);
})();

Strange question, but we are almost fighting in the team about this

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about coding-style