Build an RPG Creature Search App

how did you manage to fix it then? what did you change?

only made small change in my searchCreature function, and no change in the other function. Some other threads mentioned that the API endpoint is confusing because people arent sure whether to use creatures or creature so I tested both. Not really sure what caused that textContent error initially.

variable name shadowing. You are using the same name for two different things.

You still have that same error btw, you can’t say it’s fixed, the code that produces it is still there

why are you doing this? what does your API call return?

you made this change, it’s not just for clarity, you are changing the behaviour of your app. What does it do now?

Reverted back to this, now tests 16, 18, and 20 are left.

try {
    const creatureSearch = searchInput.value.toLowerCase();
    const res = await fetch(`https://rpg-creature-api.freecodecamp.rocks/api/creature/${creatureSearch}`);
    const data = await res.json();
    displayCreature(data)

  } catch (err) {
    console.error(err);
    alert("Creature not found");
  }

you need to find where you are using the same name for different things

it should tell you the line the error comes from

already fixed them too

I don’t know that if you don’t share the code

1 Like

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