solution for exercise 9 from nodeschool.io