function iWantToGet(ammountRequired) {
const bankomat = [100, 50, 20, 10];
let maxCach = 0;
bankomat.forEach(e=>{
maxCach += e*5
})
const result = [];
if((ammountRequired > 0) && (ammountRequired % 10 == 0) && (ammountRequired<=maxCach)){
let count = 5;
for(let i = 0; i < bankomat.length; i++){
let note = bankomat[i];
while(ammountRequired-note <= 0){
ammountRequired -= note;
result.push(note);
count--;
}
count = 5;
}
return result;
} else {
console.log('Error')
}
}
console.log(iWantToGet(500));