async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
);
if (!response.ok) {
throw new Error(`Failed to fetch joke. Status: ${response.status}`);
}
const data = await response.json();
return data;
}
export const randomJoke = await fetchRandomJoke();
const setup = randomJoke.setup;
const punchline = randomJoke.punchline;
console.log("Setup:", setup);
console.log("Punchline:", punchline);