What is a javascript anonymous function?



  • Also see:
    What is is a function expression in javascript?

    Anonymous Function.

    An anonymous function is one without a name. The link above is an example of an anonymous function.

    A normal function declaration. Here the function is called "hello"

    function hello() {
      console.log('Hello world');
    }
    hello();
    

    Where there's no function name, it's referred to as an anonymous function. An example is shown in the link above.

    let x = function (a, b) { return a + b }



© Lightnetics 2024