Built a Random Joke Generator App with HTML, CSS, and JavaScript

Day 21 of my #100DaysofCodeChallenge – Random Joke Generator App Today’s project was all about fun + functionality! I built a Random Joke Generator App using HTML, CSS, and JavaScript, and I learned how to make web pages speak, fetch live data from APIs, and copy content to clipboard — all in one project. Let me explain everything simply 👇 💡 What This App Does: Whenever you click on the “Get Joke” button, it instantly fetches a random joke from a Joke API and displays it on the screen. You can also: Click “Speak” → to hear the joke aloud using the browser’s voice (Text-to-Speech feature). Click “Copy” → to copy the joke text to your clipboard and share it anywhere. It’s a perfect blend of humor and JavaScript power! 🧠 What I Learned: 1️⃣ Fetching Data from an API: I used the fetch() method in JavaScript to get jokes from an online API (https://v2.jokeapi.dev). It returns a random joke in JSON format. Then I displayed that joke dynamically using innerText. 2️⃣ Understanding Async & Await: These keywords make JavaScript handle API calls smoothly — no freezing or waiting. async function lets us write asynchronous code, and await pauses it until data arrives. 3️⃣ DOM Manipulation: By selecting elements using getElementById, I controlled the text and buttons directly from JavaScript — making the page interactive and responsive. 4️⃣ Speech Synthesis API (Text to Speech): This was the most exciting part! I learned how browsers can actually speak using: let utterance = new SpeechSynthesisUtterance(jokeText.innerText); speechSynthesis.speak(utterance); This converts the joke into voice output — amazing, right? 5️⃣ Clipboard API: With one line, I added a feature to copy text directly to the clipboard: navigator.clipboard.writeText(jokeText.innerText); This makes it super easy to share your favorite jokes instantly. 🎨 Styling the App: I used CSS gradients, hover effects, and box shadows to make it look modern and clean. It’s simple, colorful, and gives a fun vibe — perfect for a joke app. 🚀 Key Skills Practiced: JavaScript API integration Async/Await for asynchronous programming Speech Synthesis API for voice output Clipboard API for text copying Dynamic DOM updates UI design using CSS Flexbox and Gradients 🌱 My Takeaway: Small projects like this teach real development concepts while keeping the process exciting. When you see your code making the browser talk — that’s when coding becomes truly magical ✨ 💬 Let’s Connect: I’d love to know — what’s the funniest project you’ve ever built? Drop your thoughts or ideas below! 👇 🏷️ Hashtags for Reach: #Day21 #100DaysOfCode #JavaScript #WebDevelopment #Frontend #CodingJourney #LearningByBuilding #APIs #SpeechSynthesis #ClipboardAPI #CodingCommunity #DeveloperJourney #TechLearning #CodeNewbie #HTMLCSSJS #DailyCoding Saurabh Shukla git - https://lnkd.in/gDJ9jrFJ

  • text

To view or add a comment, sign in

Explore content categories