Hi, there is a bug in this chapter.
I tried even with the course solution.
Yes, i reseted the code, yes i copy pasted the solution, still not working.
This is the result :
[ ‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’,
‘greenTea’ ] [ ‘blackTea’,
‘blackTea’,
‘blackTea’,
‘blackTea’,
‘blackTea’,
‘blackTea’,
‘blackTea’,
‘blackTea’,
‘blackTea’,
‘blackTea’,
‘blackTea’,
‘blackTea’,
‘blackTea’ ]
Scriptfully yours.
Gianfranco.-
Link:
Solution ( this is FCC solution):
// Function that returns a string representing a cup of green tea
const prepareGreenTea = () => ‘greenTea’;
// Function that returns a string representing a cup of black tea
const prepareBlackTea = () => ‘blackTea’;
/*
Given a function (representing the tea type) and number of cups needed, the
following function returns an array of strings (each representing a cup of
a specific type of tea).
*/
const getTea = (prepareTea, numOfCups) => {
const teaCups = ;
for (let cups = 1; cups <= numOfCups; cups += 1) {
const teaCup = prepareTea();
teaCups.push(teaCup);
}
return teaCups;
};
// Add your code below this line
const tea4GreenTeamFCC = getTea(prepareGreenTea, 27);
const tea4BlackTeamFCC = getTea(prepareBlackTea, 13);
// Add your code above this line
console.log(tea4GreenTeamFCC, tea4BlackTeamFCC);