Code Challenge: Change Dispenser
Friday, June 20th, 2008 • Related • Filed Under
I recently encountered a brain teaser that asked to take an amount of change and return the equivalent in dollars and coins. Here's the five-minute solution I first came up with. function makeChange (money) { var i, num, output = [], coins = [ [100, "dollar", "dollars" ], [25, "quarter", "quarters"], [10, "dime", "dimes" ], […]