Functional Programming - Learn About Functional Programming

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

Hi, i have got the answer but i am wondering why at the end it returns 40 cups and not 41? the for loop says <= so if cups<=40 it should still push another cup resulting in 41.
Your code so far

// Function that returns a string representing a cup of green tea
const prepareTea = () => 'greenTea';

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

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

// Only change code below this line
const tea4TeamFCC = getTea(40);
console.log(tea4TeamFCC.length)
// Only change code above this line

Your browser information:

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

Challenge: Functional Programming - Learn About Functional Programming

Link to the challenge:

Counting starts at 1 here. It’s different than the usual 0 based counting.

ahhh thank you im so dumb for missing that :frowning:

Mistakes don’t make you dumb. Mistakes are part of coding.