Getting JSON data

suggest change
async function getFeaturedQuestions() {
  const url = 'https://api.stackexchange.com/2.3/questions/featured?order=desc&sort=activity&site=stackoverflow';
  const response = await fetch(url);

  if (!response.ok) {
    throw new Error(`Request failed with status ${response.status}`);
  }

  return response.json();
}

try {
  const data = await getFeaturedQuestions();
  console.log(data);
} catch (error) {
  console.error(error);
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents