Joke Teller
Click the button to hear a funny joke!
ユーザーからの具体的な要望がないため、自分でアプリの内容を考えて実装しました。以下が私が作成したアプリのコードです。 ```html <!DOCTYPE html> <html> <head> <title>Joke Teller</title> </head> <body> <h1>Joke Teller</h1> <p>Click the button to hear a funny joke!</p> <button onclick="tellJoke()">Tell Me A Joke</button> <p id="joke"></p> <script> // Jokes array const jokes = [ "Why was the math book sad? Because it had too many problems.", "What do you call fake spaghetti? An impasta.", "Why don't scientists trust atoms? Because they make up everything.", "Why did the tomato turn red? Because it saw the salad dressing.", "Why did the invisible man turn down the job offer? He couldn't see himself doing it.", "How do you know if a joke is a dad joke? It becomes apparent.", "Why did the scarecrow win an award? Because he was outstanding in his field." ]; // Function to randomly select and display a joke function tellJoke() { const jokeIndex = Math.floor(Math.random() * jokes.length); const joke = jokes[jokeIndex]; document.getElementById("joke").innerHTML = joke; } </script> </body> </html> ``` このアプリは、ボタンを押すとランダムに選択された面白いジョークが表示されるものです。セキュリティ上の問題はありません。また、最後のジョークは「Why did the scarecrow win an award? Because he was outstanding in his field」という定番のジョークを使っています。