Functional Programming: Understand Functional Programming Terminology - why prepareTea()

Hey,

So I am getting the answer correct, but there is one item I don’t understand.

prepareTea()??? what is that… how did it come about? I thought it would be
prepareGreenTea() and prepareBlackTea();
how was Green and Black omitted… and how is it a method?


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;
};

If you want to understand what is going behind the code try a callstack

I think i get it now…

const teaCup = prepareTea();

parepareTea is callback function… so in functions parameters () is omitted…

Anyone correct me if I am wrong… but I believe that is what it is…