Textbook - Chapter 2 - Example 2

Example two of chapter 2 in javascript textbook.