Learn About Functional Programming help

Learn About Functional Programming help
0.0 0

#1

Tell us what’s happening:

Your code so far


/**
 * A long process to prepare tea.
 * @return {string} A cup of tea.
 **/
const prepareTea = () => 'greenTea';

/**
 * Get given number of cups of tea.
 * @param {number} numOfCups Number of required cups of tea.
 * @return {Array<string>} Given amount of tea cups.
 **/
const getTea = (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 tea4TeamFCC = getTea(); // :(
// Add your code above this line

console.log(tea4TeamFCC);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/learn-about-functional-programming


#2

The function getTea accepts one parameter - the number of cups. You are supposed to tell it how many cups you want. From the instructions:

Call the getTea function to get 40 cups of tea for the team, and store them in the tea4TeamFCC variable.