I took a small break from FCC and I am now back on it. I am currently on the functional programming section and early on we are introduced to callback functions. It is somthing i have struggled with for a few month now. I was wondering if someone could help me wrap my head around the below problem, and just to give me another resource to read about callbacks. I understand the idea behind them, i think i am just struggling with the execution portion.
const prepareGreenTea = () => 'greenTea';
const prepareBlackTea = () => 'blackTea';
const getTea = (prepareTea, numOfCups) => {
const teaCups = [];
for(let cups = 1; cups <= numOfCups; cups += 1) {
const teaCup = prepareTea();
teaCups.push(teaCup);
}
return teaCups;
};
const tea4GreenTeamFCC = getTea('green Tea', 27) // :(
const tea4BlackTeamFCC = null; // :(
console.log(
tea4GreenTeamFCC,
tea4BlackTeamFCC
);