Learn About Functional Programming Error

Tell us what’s happening:
Keep getting Error: Request Error: 0

Not sure what I’m doing wrong.

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(40); // :(

// Add your code above this line

console.log(tea4TeamFCC);

Your browser information:

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

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

Your code runs fine. When are you getting the error?

When I run the code it gives me the error. Even in firefox. Not sure if maybe its my new OS? Even in the next lesson I get the same error.

Is this still happening? I wonder if there was some trouble connecting to the freeCodeCamp servers.

Yes. I’m still getting the Error. It works on my phone but not my macbook.

What does the developer console on your macbook show is the problem when it doesn’t run?

Error: Request Error: 0

Are you using Safari on your macbook?
Does Safari have any updates?
What results do you have from a different browser such as Firefox?

Safari and Firefox have different developer consoles. From either of them you should be able to find a network tab, which should be able to reveal what is giving the request error.

I’m using chrome. No updates that I know of. It was working fine before I started the functional programming section.

Could it be some extensions that are causing the issue?

Run Chrome with the --disable-extensions command-line option, and confirm that extensions are temporarily disabled.
Details: https://superuser.com/questions/254579/how-to-open-google-chrome-with-extensions-disabled-turned-off

Beyond that, where is the Request error coming from? Is it a script, or a file attempting to be loaded?

1 Like