How does naming an anonymous function in JavaScript make a difference?

后端 未结 4 609
北恋
北恋 2021-02-14 07:08

I am analyzing the following two urls from John Resig\'s site, but I am not understanding how giving a name to the anonymous function has made a difference.

My understan

4条回答
  •  孤城傲影
    2021-02-14 07:45

    The site http://kangax.github.com/nfe/ is a great reference. Yes, as far as it is a function expression the name will only be available inside (e.g. for recursive calls, as in the demonstration) and also helps for debugging (e.g. in stack traces), because it sets the name property of the function.

提交回复
热议问题