Hello;
I'm trying to write this function where whatever the amount it should give change in coin accordingly and result sent as an object. Finding it a but tricky - any support on how the code should be written
function changeCalculator (num) {
var res = {};
for (var i = 0; i < num.length; i++) {
}
return res;
};
result should be in this format:
changeCalculator(13);
// should return
{'10':1,'2':1,'1':1}
Any help in writing the function will be appreciated. Thanks
I'm trying to write this function where whatever the amount it should give change in coin accordingly and result sent as an object. Finding it a but tricky - any support on how the code should be written
function changeCalculator (num) {
var res = {};
for (var i = 0; i < num.length; i++) {
}
return res;
};
result should be in this format:
changeCalculator(13);
// should return
{'10':1,'2':1,'1':1}
Any help in writing the function will be appreciated. Thanks