Javascript Solution to Pragdave's Code Kata 19.