dwyl / dwyl/learn-tdd

Alternative solution for coins !

Open
#91 2 comments 6 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
2.8k
Forks
341
PR merge metrics
No merged PRs in 30d

Description

Hi ! thank you very much for you amazing tutorials !

Here is my solution for the coins

```
function getChange (totalPayable, cashPaid) {

var result = [];

var coins = [200, 100, 50, 20, 10, 5, 2, 1];

var diffrence = cashPaid - totalPayable;

var i = 0;

do {
if (coins[i] <= diffrence)
{
result.push(coins[i]);
diffrence = diffrence - coins[i];
}
else
i++;
}
while (i < coins.length);

return result;
}
```

Contributor guide

Open the contributing guide

Research direction

The issue contains an alternative JavaScript getChange solution but names no repository file, exercise location, or requested change. Start by reviewing the coins tutorial and its existing tests, then determine whether this example should be incorporated and what acceptance criteria would apply.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.