Answer:
Hi!
The answer coded in Javascript is:
function minimalNumbersOfBanknotes(input) {
var banknotes = [50, 20, 10, 5, 1];
var output = '';
//Each while writes on output variable the banknote and substract the same quantity on input variable.
//If the input is lesser than the value of while banknote, step into next while.
for (var i = 0; i < banknotes.length; i++) {
while(input >= banknotes[i]) {
output = output + ' ' + banknotes[i];
input = input - banknotes[i];
}
}
return output;
}