Medium
What is the output of the following JavaScript code?
function fetchData() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve("Data fetched!");
}, 1000);
});
}
async function displayData() {
const data = await fetchData();
console.log(data);
}
displayData();
console.log("After displayData call");
Author: Vincent CotroStatus: PublishedQuestion passed 2565 times
Edit
28
Community Evaluations
Similar QuestionsMore questions about Javascript