Functions are like programs inside of our program.
When to use
Functions allow us to reuse code.
Functions only run if you specifically call them. Otherwise they are ignored by the normal flow of our code.
Functions take this form:
// do something;
To call a function:
You can pass parameters into a function when you call it:
Hints & tips
- functions are programs inside your program
- functions only run if you specifically call them
- You can pass parameters into a function when you call it
Lesson notes are only available for subscribers.