Make your website interactive with JavaScript
Difficulty: Beginner ● Progress: 0 / 0 modules completed
Create a function
A function is a piece of code that can be reused, and above all that can be parameterized. This allows you to avoid rewriting the same piece of code multiple times, and thus to program faster, more efficiently, and to keep your code generally more readable!
Here is a basic function, which adds two numbers together and returns the result:
function add(a, b){
return a + b;
}
You need a free account to read this module