Images

Writing Functions

image

         To view the accompanying video for this lesson, please visit mhprofessional.com/nixonjavascript/.

Apart from using conditional statements such as if() and switch(), and loops such as while() and for(), there’s another way you can control program flow called the function. Functions are sections of code that you call from any other part of code (or even the function itself, which is known as recursion), and which then perform one or more actions and then return.

When functions return, they may also return a value back to ...

Get JavaScript: 20 Lessons to Successful Web Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.