Build a Fortune Telling App - Step 24

Tell us what’s happening:

I get this error “You should declare a response variable inside the fetchCardsData method.” I m not sure what I am doing wrong. Can someone help?

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: index.ts */
// User Editable Region

try {
  let response = await fetch(`${CDN_URL}/card_data.json`);
} catch(e) {

}


// User Editable Region

Your browser information:

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

Challenge Information:

Build a Fortune Telling App - Step 24

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-fortune-teller-app/68ed4585f6a1d6e07b9d09c5.md at main · freeCodeCamp/freeCodeCamp · GitHub

Hi @rajesh.kathiru

Try declaring with the const keyword.

Happy coding

Thank you @Teller :slight_smile:. I wonder how you found out the issue. Is there a way to dig into the error and not just rely on the error message.

If one declaration doesn’t work then try another.

Same with functions. If arrow function doesn’t work, then use a regular function.