Answers for "11.2.1. Anonymous Function Variables"

0

11.2.1. Anonymous Function Variables

/*Anonymous functions are often assigned to variables when they are 
created, which allows them to be called using the variable's name.

Let's create and use a simple anonymous function that returns the sum
of two numbers*/

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

console.log(add(1, 1));

//2

/*The variable add refers to the anonymous function created on lines
1 through 3. We call the function using the variable name, since the 
function doesn't have a name.*/
Posted by: Guest on July-07-2021

Code answers related to "11.2.1. Anonymous Function Variables"

Code answers related to "Javascript"

Browse Popular Code Answers by Language