Skip to main content
100%

Random Ron - No Duplicates

✓ Published0🌍 Public
Aangusgrant
Last edited Oct 26, 2022
Created on Oct 26, 2022

This example displays a single Ron Swanson quote at a time, fetched from the ron-swanson-quotes.herokuapp.com API, with a button to load a new one. It shows how to avoid immediate duplicate quotes by storing recent quotes in an array; when a quote repeats, the app fetches again, and once 50 unique quotes are stored, the oldest is removed to make room. The code uses the Fetch API to request JSON data and updates the page’s blockquote element, while an `<img>` tag embeds a related GIF.

AI-generated description

Similar vizzes