Free Code Camp - Understand Functional Programming Terminology

Tell us what’s happening:
Describe your issue in detail here.

The code below is provided by free code camp does not work can u tell me the reason why is it not working?

   [spoiler]
/**
 * A long process to prepare green tea.
 * @return {string} A cup of green tea.
 **/
const prepareGreenTea = () => "greenTea";

/**
 * Get given number of cups of tea.
 * @param {function():string} prepareTea The type of tea preparing function.
 * @param {number} numOfCups Number of required cups of tea.
 * @return {Array<string>} Given amount of tea cups.
 **/
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

[/spoiler]
Challenge: Understand Functional Programming Terminology

Link to the challenge:

What do you mean when you say it’s not working? What are you trying to accomplish? What problems are you having? What have you already tried?


see in this pic i tried free code camp’s provided code but its not working it shows an error

Please Help Me to Complete this exercise

Look at the error. It says that prepareBlackTea is not defined.

You appear to have changed code outside of the area you are told to, including deleting the declaration of prepareBlackTea.

1 Like

Ok Thanks For telling

I’m glad I could help. Happy coding!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.