Naming an anonymous function

后端 未结 6 1954
心在旅途
心在旅途 2020-12-05 18:33

Is it possible to somehow set a name for anonymous functions?

There is no need to add function names to the namespace for anonymous functions but I would like to avo

6条回答
  •  伪装坚强ぢ
    2020-12-05 18:56

    Your second example is using a named function expression, which works fine in most browsers but has some problems in IE that you should be aware of before using it. I recommend reading kangax's excellent article on this subject.

提交回复
热议问题