Changing variable name makes tests fail

All is good when callback argument is called data.
Changing the name of the variable to anything other than data makes tests fail.

Changing the response argument name does not fail tests.
It may be a buggy behavior.

  document.getElementById('getMessage').onclick= () => {
    // Add your code below this line
    .then(response => response.json())
    .then(d => {
      document.getElementById('message').innerHTML = JSON.stringify(d);

    // Add your code above this line

Challenge: Get JSON with the JavaScript fetch method

Link to the challenge:

There are regex checks in the tests that are looking for data. I’m sure the tests can be unconstrained to allow for anything for the callback parameter.

If you want you can open an issue for it. Or create a PR with a fix.

Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

Thank you, for pointing this out. It is definitely not a well-made test:


I have opened an issue on it: "Get JSON with the JavaScript fetch method" Test Too Specific · Issue #41750 · freeCodeCamp/freeCodeCamp · GitHub

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.