What will be the output of the following code?
async function fetchData() {
const response = await fetch('https://api.example.com/data');
if (!response.ok) {
throw new Error('Failed to fetch data');
}
return response.json();
}
async function displayData() {
try {
const result = await fetchData();
console.log(result);
} catch (error) {
console.log('Error:', error);
}
}
displayData();