-
Notifications
You must be signed in to change notification settings - Fork 2
Functions
Marcelo Barsotti edited this page Jan 3, 2019
·
5 revisions
A sequence of computer program instructions to perform a specific task, packaged as a unit, is called a subroutine. In Javascript you create subroutines using functions. There are many reasons to write your code in functions. Among them:
- you can organize your code in smaller parts, that are easier to understand on their own;
- you can reuse the function over and over again and from multiple places (for example,
console.log
is a function you will use many, many times throughout this course); - you can isolate parts of your code from others, making it harder to introduce unwanted errors.