# Xplanation to the problem

please i need a detailed explanation of this codes:

**more especially from the looping step down **

``````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(prepareGreenTea, 27);
const tea4BlackTeamFCC = getTea(prepareBlackTea, 13);

console.log(
tea4GreenTeamFCC,
tea4BlackTeamFCC
);

``````

If I rewrite it like so, would it be clearer?

``````/**
* STEP 1. Create array of quantity size
* STEP 2. Fill it with tea (by running tea preparation function that was passed as first argument)
*/
const getTea = (prepareFn, qty) => Array(qty).fill(prepareFn());
``````

i need the explanations.

`teaCups` - a tray
`cups` - number of cup you’re preparing at the moment
`numOfCups` - total number of cups you need to prepare

Until number of `cups` made is less or equal to `numOfCups` you’re going to `prepareTea()` and push it (place it) on the tray (`teaCups`). When you finish you will return a tray of tee.

This code has very basic concepts, it’s very hard to explain what’s going on here in other words - it won’t be simpler than this I’m afraid

i love the way you hint it. that’s great, i appreciates