To run the program, save this file as blast.html and open it in a web browser. Then, click the blast button and enjoy the jokes!
Blast!
// An array of 190 jokes var jokes = [ "What do you call a fish wearing a bowtie? Sofishticated.", "How do you make a tissue dance? You put a little boogie in it.", "What do you call cheese that isn't yours? Nacho cheese.", // ... more jokes ... ]; // A function that displays a random joke in a pop-up window function showJoke() // Generate a random number between 0 and 189 var index = Math.floor(Math.random() * 190); // Select a joke from the array var joke = jokes[index]; // Show the joke in a pop-up window alert(joke); // Get the blast button element var blast = document.getElementById("blast"); // Add a click event listener to the blast button blast.addEventListener("click", showJoke);
a104e7fe7e