11 2 1 anonymous function variables

Solutions on MaxInterview for 11 2 1 anonymous function variables by the best coders in the world

showing results for - "11 2 1 anonymous function variables"
Alexander
04 Oct 2018
1/*Anonymous functions are often assigned to variables when they are 
2created, which allows them to be called using the variable's name.
3
4Let's create and use a simple anonymous function that returns the sum
5of two numbers*/
6
7let add = function(a, b) {
8   return a + b;
9};
10
11console.log(add(1, 1));
12
13//2
14
15/*The variable add refers to the anonymous function created on lines
161 through 3. We call the function using the variable name, since the 
17function doesn't have a name.*/