...

/

Specifying Function Expressions

Specifying Function Expressions

In this lesson we will learn how to specify a function expression. Let's begin!

JavaScript has a number of great things that are built on function expressions. Just like other objects, functions can be assigned to variables:

Node.js
var add = function (a, b) {
return a + b;
}

This assignment ensures that you can invoke the function through the variable, just like if it were a statically declared function:

Node.js
var add = function (a, b) {
return a + b;
}
console.log(add(12, 23));

...