what is the difference between the below two syntaxes?

Posted by Hari on Programmers See other posts from Programmers or by Hari
Published on 2012-06-11T06:02:58Z Indexed on 2012/06/11 10:47 UTC
Read the original article Hit count: 293

Filed under:
|

1.

 $(function () {
       function foo() { return true; }
       log(bar());                        // getting error
       var bar = function() { return true; };   
  });

2.

$(function () {
        function foo() { return true; }
        log(bar());                        // working 
        function bar() { return true; };  
});

in above snippets log is my custom function to log the result.

© Programmers or respective owner

Related posts about JavaScript

Related posts about jQuery