Solution for Exercise 12.4

This is a solution for Exercise 12.4. See the source code of file app.js.