JavaScript Tutorials
Lesson 5 - Functions
A function is basically another program. You can call that function by doing functionName();
in JS or add an event in a tag like onclick="functionName()". To create a function, you do function functionName(){"Code"}. You don't write the code part, you write the code where the code quote is.
Instead of triggering an event and writing the same code over and over again, you can write the same code once in a function and call it whenever you need it. Functions are super helpful and save a whole lot of time.
< Previous-------------------------
Next >