WDD 131: Dynamic Web Fundamentals

W03 Learning Activity: JavaScript Functions

Overview

Functions in JavaScript are common programming control structures. They are blocks of code that can be called by name multiple times throughout a program to perform specific tasks. Functions can receive input data and return output data back to the caller.

"Functions are one of the fundamental building blocks in JavaScript. A function in JavaScript is similar to a procedure—a set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the output. To use a function, you must define it somewhere in the scope from which you wish to call it. – MDN"

Prepare

Check Your Understanding

Given the following code snippet:

let firstName = 'Antonia';
let lastName = 'Francesca';

Optional Resources