Skip to lesson content
Dev4Hub

Lesson 3 of 4

JS Functions

1 min read1 sectionAI tutor ready

JavaScript Functions

A JavaScript function is a block of code designed to perform a particular task. It is executed when "something" invokes it.

A simple function

JavaScript
function add(a, b) {
  return a + b;
}
console.log(add(3, 4));

Output

7

You've reached the end of this lesson.

Mark it complete to keep your place in the course — it counts toward your progress and your streak.