All lessons

Functions

9 min · JavaScript

Package code under a name so you can reuse it.

JavaScript · Functions0/5 cleared

Enemy 1 of 5

A function is a named block of code. Define it with function, give it a name and parameters in ( ), and a body in { }. It runs only when you call it.

Use return to hand a value back to whoever called it.

You
Syntax Skeleton

Loading editor...

Ln 1, Col 1Spaces: 4
Sign up to fightTarget output: 10