Difference between “anonymous function” and “function literal” in JavaScript?

后端 未结 5 1311
青春惊慌失措
青春惊慌失措 2020-12-09 12:55

The book Learning JavaScript defines anonymous functions as follows...

Functions are objects. As such, you can create them - just like a String

5条回答
  •  -上瘾入骨i
    2020-12-09 13:35

    function foo(){
        alert("i'm foo, nice to meet you!");
    }
    var bar = function(){
        alert("I am an anonymous function assigned to the variable \"bar\"");
    }
    

提交回复
热议问题