[removed] what's the difference between a function name & function reference?

前端 未结 5 1193
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 02:41

I\'m reading the Google Maps API and it states that the:

\"callback: The function to call once the script has loaded. If using the Auto-loading feature, this         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 03:41

    The name of a function is a string such as 'foo' in this case:

    function foo() {}
    

    A reference to a function is any variable that is set to the value of the function itself (not the result of calling it).

    Functions in Javascript can be anonymous - you can have a reference to a function that has no name.

    var bar = function() {}
    

提交回复
热议问题