//sample solution
function howManyCoins (coinName, coinAmount, coinsSoFar) {
//fill this in
if (change < coinAmount) {
console.log (coinsSoFar + " " + coinName);
} else {
change -= coinAmount;
return howManyCoins(coinName, coinAmount, coinsSoFar + 1);
}
}
change = 4.94;
console.log("Give them:");
howManyCoins("dollar bills", 1.00, 0);
No comments:
Post a Comment