Showing a dialog box or writing text to the screen is a side effect. A lot of functions are useful because of the side effects they produce. Functions may also produce values, in which case they don’t need to have a side effect to be useful. For example, the function Math.max takes any amount of number arguments and gives back the greatest.
// → 4
console.log(Math.min(2, 4) + 100);
// → 102
The next chapter explains how to write your own functions.
No Starch Press; 3rd edition.