Function stored in a variable

Ok I am I am here to talk about anonymous function in JavaScript, what does that mean, it means that you can access  function without using its name.

Syntax to creat anonymous function:
var variablename= function(1,2){return a*b};
 //returns 5
var a=variablename(1,2);
Console.log(a);//prints 5 in console.

More details below:

Function expression has been stored in a variable the variable can be used as a function. function above is actually an anonymous function, function without a name. functions stored in a variable do not need function names they are always invoked  or  called using variable name.the function above ends with a semicolon because it is part of an executable statement.

Comments