17 lines
386 B
JavaScript
17 lines
386 B
JavaScript
async function fetchDataFromApi() {
|
|
console.log('fetchDataFromApi() start...');
|
|
|
|
const res = await fetch('https://v2.jokeapi.dev/joke/Programming?type=single');
|
|
const json = await res.json();
|
|
console.log(json.joke);
|
|
|
|
console.log('fetchDataFromApi() done.');
|
|
};
|
|
|
|
async function init() {
|
|
await fetchDataFromApi();
|
|
console.log('Finished fetching data');
|
|
}
|
|
|
|
init();
|