おれおゲーム
「おれお」になるように3文字のひらがなを選ぼう!
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>おれおゲーム</title>
</head>
<body>
<h1>おれおゲーム</h1>
<p>「おれお」になるように3文字のひらがなを選ぼう!</p>
<div id="word"></div>
<button onclick="generateWord()">おれおボタン</button>
<script>
const hiraganaList = ["あ","い","う","え","お","か","き","く","け","こ","さ","し","す","せ","そ","た","ち","つ","て","と","な","に","ぬ","ね","の","は","ひ","ふ","へ","ほ","ま","み","む","め","も","や","ゆ","よ","ら","り","る","れ","ろ","わ","を","ん"];
const targetWord = "おれお";
let currentWord = "";
function generateWord() {
currentWord = "";
for (let i = 0; i < 3; i++) {
currentWord += hiraganaList[Math.floor(Math.random() * hiraganaList.length)];
}
document.getElementById("word").textContent = currentWord;
if (currentWord === targetWord) {
document.getElementById("word").textContent += "(おれお!)";
}
}
</script>
</body>
</html>