trying to write a function that takes the change you have in an array [quarters,dimes,nickels,pennies]
and second parameter of the cost value n
.
So ([quarters,dimes,nickels,pennies],n
)
then I wanna use the reduce method to create an ES6 style of code
I want to understand how to use reduce and grab the second parameter in my code
const changeEnough = ([25, 20, 5, 0], 4.25)
const ct = (accumulator, currentValue) =>
((accumulator + currentValue) - intialValue >= 0);
console.log(changeEnough.reduce(ct));
error message I am getting is
changeEnough.reduce is not a function
I have figured that I am not asking the other value of 4.25 in my code