Naming an anonymous function

后端 未结 6 1953
心在旅途
心在旅途 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:57

    An anonymous function is a function without a name, it is executed from where it is defined. Alternatively, you can define the debugging function before using it.

    function debuggingName() { 
        alert("x"); 
    }
    
    $("object").bind("click", debuggingName);
    

提交回复
热议问题