Functions in JavaScript

Learn about the fundamental building blocks of most JavaScript programs—functions.

Functions are an essential part of any programming language. They’re the fundamental building blocks of most JavaScript programs, which makes understanding them an essential skill to master.

Defining a function

The most common way to define a function in Javascript is to use a function declaration like the one shown below:

Get hands-on with 1200+ tech skills courses.