Skip to content

Fetch is not working as expected (2023) #33

@rd3ka

Description

@rd3ka

PROBLEMS WITH FETCH

Below is your implementation of fetch -

fetch("questions.json")
  .then((response) => response.json())
  .then((data) => {
    questions = data;
    console.log(questions);
    start();  //<--problem
  })
  .catch((err) => {
    console.log(err);
  });

This piece of code returns an array of empty objects when start() is being called from then, image shown below
2023-02-28T14:11:34,247883883+05:30

If start() function is not called from then it magically somehow works, image shown below:
2023-02-28T14:10:09,460584215+05:30

P.S: I happen to be learning, javascript and web development in general and that is why I came across this playlist. So I cannot progress further to complete this app as I am stuck here.
Request you to provide a workaround as soon as possible :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions