Understand Functional Programming Terminology problem

Tell us what’s happening:
Hello, I think that I am not really getting the concepts right. So the prepareTea function was added to set the type of tea(I tried adding the “type parameter”. But how exactly is the type stored, if the getTea function only return the array? In the end, the tea4FCCs only end up storing cups of tea,discriminating the type,right?

Your code so far


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

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

/**
 * 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(type), numOfCups) => {
  const teaCups = [];

  for(let cups = 1; cups <= numOfCups; cups += 1) {
    const teaCup = prepareTea();
    teaCups.push(teaCup);
  }

  return teaCups;
};
function prepareTea(type) {
return type;
}

// Add your code below this line

const tea4GreenTeamFCC = getTea("green", 27); // :(
const tea4BlackTeamFCC = getTea("black", 13); // :(

// Add your code above this line

console.log(
  tea4GreenTeamFCC,
  tea4BlackTeamFCC
);

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/understand-functional-programming-terminology

The only lines of code you should be changing are the two above. Do not change the original functions like getTea. You need to assign the result of a call to the getTea function for each of these lines above. Study the getTea code and comments so you can figure out what two things you need to pass to the getTea function in order to get the desired results.

Figured it out. thanks!

Hello All. I’m unable to understand some basic info in this challenge.
First, I don’t understand the comments:

/**

  • A long process to prepare green tea.
  • @return {string} A cup of green tea.
    **/

and

/**

  • A long process to prepare black tea.
  • @return {string} A cup of black tea.
    **/

What do they mean by ‘A long process to prepare green tea’ and ‘A long process to prepare black tea’ ? These don’t really seem relevant to the challenge unless I’m missing something.

Also, in the instructions they state: Callbacks are the functions that are slipped or passed into another function to decide the invocation of that function. What is meant by ‘to decide the invocation of that function’? Specifically, what does ‘invocation’ mean in this context? How are we deciding the invocation?

They also state, ’ Functions that can be assigned to a variable, passed into another function, or returned from another function just like any other normal value, are called first class functions. In JavaScript, all functions are first class functions.’ If all JS functions are first "class functions,’ why don’t we just call them ‘functions’ like we normally do? Why use more words to refer to the same thing?

Also, they state, ‘Note that the getTea function has been modified so it now takes a function as the first argument.’ How do we know that the first argument is a function?

I haven’t written any code yet since I’m still trying to figure out the explanation/instructions.

Any guidance on the above questions would be appreciated.

Your browser information:

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

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