Named and Anonymous Functions

In this lesson, you will see how to name a function, create an anonymous function as well as how to categorize them.

Expressions and declarations

JavaScript, and therefore TypeScript, have many ways to define functions. At a high level, functions can be divided into function declarations and function expressions. A function declaration is when a function is defined by not assigning the function to a variable. e.g.

function myFunction() ...

A function expression is a function assigned to a variable. e.g.

const f = function() ...

Get hands-on with 1200+ tech skills courses.