Learn About Functional Programming 2

Learn About Functional Programming 2
0

#1

Tell us what’s happening:

How can I do so that
The tea4TeamFCC variable should hold 40 cups of tea for the team.
The tea4TeamFCC variable should hold cups of green tea.

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 = [40];
  
  for(let cups = 1; cups <= numOfCups; cups += 1) {
    const teaCup = prepareTea();
    teaCups.push(teaCup);
  }

  return teaCups;
};

// Add your code below this line

const tea4TeamFCC = 40; // :(

// Add your code above this line

console.log(tea4TeamFCC);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

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


#2

The instruction says

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

Instead of passing in a number. Make sure you pass in getTea function and pass in 40 as a parameter.


#3

So you mean , const tea4Team=getTea(40) instead of const tea4TeamFCC = 40;

Got it Thanks