In this video we are going to learn about function expression.
A JavaScript function can also be defined using an expression.
A function expression can be stored in a variable.
After a function expression has been stored in a variable the variable can be used as a function.
So let create function expression.
Goto te project and inside the index.js file.
First of all remove all these lines and now create a variable.
Lets say variable name is message.
and inside the this message variable assing a function so type here.

var message = function(){
return \"Hello World!\";

This is function expression, in this function there is no any function name,
Here function name is omitted. Now just call this message variable like function.


Lets run this.
So goto the command prompt and here just type.

node index.js

You can see here \"Hello World\".
We can also use function expression as argument.
Let see.
First off all create a another expression function here.
So just type.

var sum= function(a,b)
return a+b;

This is sum expression function which returns sum of two numbers.

Now create another function.
Inside this function use function as parameter.

var calculateSum = function(fun)
return fun();

Now call this calculate sum function and pass the sum function here.
Ok, so just type here.


Now, Lets check and you can see the result 11.
So in this way you can create an use function expression.