JS solution to Problem 17 added