Codetainer LogoCodetainer Acad

Lessons

Lesson 28: Random Joke Generator

Mini App: Get Random Jokes

Use an API like the JokeAPI to fetch a new joke every time the user clicks a button.

This reinforces event handling and fetch requests.


fetch("https://v2.jokeapi.dev/joke/Any")
  .then(res => res.json())
  .then(data => console.log(data.joke));
CodetainerAcad