← JavaScript

Functions – Declaring

Declares a reusable block of code with a name, which can be run later by calling it.

Understanding Functions – Declaring in JavaScript

What it does: function is exactly the keyword that starts a declaration. Parentheses always follow the function name, even if empty. function creates a named block of code you can run later. Even with no parameters, the parentheses () are required. JavaScript is case-sensitive, so 'function' must be lowercase. Writing greet(); is how you actually run the function. greet() and Greet() would be treated as two different names. The code the function runs is wrapped in { }.

Common mistakes: 'function' must be lowercase - a capital F causes an error. Function names are case-sensitive - it should be sayHi(), not sayhi().

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 31–40) and word search (Modules 21–52).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Does 'function' declare a reusable block of code?
YesNo
Matches
Function greet() { console.log("Hi"); }
↓
Wrong - 'function' must be lowercase
Applying
Meanings
Term
function
Meaning
Declares a reusable block of code with a name, which can be run later by calling it.
Practice
function greet() {
Testing
Gaps
greet() {
Check Answer
Spots
1Function greet() {
2console.log("Hi");

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Woodpecker' badge — Tap Tap Tap, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Does 'function' declare a reusable block of code?
A. Yes ✓
B. No
function creates a named block of code you can run later.
2. Does a function need parentheses after its name?
A. No
B. Yes ✓
Even with no parameters, the parentheses () are required.
3. Must 'function' be written in lowercase?
A. Yes ✓
B. No
JavaScript is case-sensitive, so 'function' must be lowercase.
4. Does calling a function require parentheses after its name?
A. No
B. Yes ✓
Writing greet(); is how you actually run the function.
5. Are JavaScript function names case-sensitive?
A. Yes ✓
B. No
greet() and Greet() would be treated as two different names.

Match the Pairs

function greet() { ... } → Declares a reusable function named greet
greet(); → Runs the code inside the greet function
The keyword used to declare a function → function
Follows a function's name in its declaration → ()
Function greet() { console.log("Hi"); } → Wrong - 'function' must be lowercase
function wave { console.log("Wave"); } → Wrong - missing the parentheses after the function name

Key Term

function
Declares a reusable block of code with a name, which can be run later by calling it.

Fill in the Blanks

1. function greet() {
Hint: Type the keyword that declares a function.
2. function greet() {
Hint: Type the opening symbol of a function's empty parentheses.
3. function sayBye() {
Hint: Type the keyword that declares a function.
4. function sayBye() {
Hint: Type the opening symbol of a function's empty parentheses.
5. greet();
Hint: Type the opening symbol of the parentheses that call the function.

Spot the Error

Question 1
A Function greet() {
B console.log("Hi");
C }
Line A — 'function' must be lowercase - a capital F causes an error.
Question 2
A function sayHi() {
B console.log("Hi");
C }
D sayhi();
Line D — Function names are case-sensitive - it should be sayHi(), not sayhi().
Question 3
A function wave {
B console.log("Wave");
C }
Line A — A function declaration needs parentheses after its name.
Question 4
A function jump() {
B jump;
C console.log("Jump");
D }
Line B — Calling a function needs parentheses: jump().
Question 5
A function run() {
B console.log("Run")
C }
Line B — This line is missing a semicolon, but that's not required in JS.

Student with a class code? Join your class →