An example solution for a typical WDI javascript homework