{"id":6425,"date":"2023-11-17T21:37:42","date_gmt":"2023-11-17T21:37:42","guid":{"rendered":"http:\/\/www.joapen.com\/jepc\/?page_id=6425"},"modified":"2023-11-28T22:14:06","modified_gmt":"2023-11-28T22:14:06","slug":"109-power-words","status":"publish","type":"page","link":"http:\/\/www.joapen.com\/jepc\/109-power-words\/","title":{"rendered":"109 Power Words"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Random Word Display with Timer and Counter<\/title>\n<script>\nlet words = [\n    \"the\", \"of\", \"and\", \"a\", \"to\", \"in\", \"is\", \"you\", \"that\", \"it\",\n    \"he\", \"for\", \"was\", \"on\", \"are\", \"as\", \"with\", \"his\", \"they\", \"at\",\n    \"be\", \"this\", \"from\", \"I\", \"have\", \"or\", \"by\", \"one\", \"had\", \"not\",\n    \"but\", \"what\", \"all\", \"were\", \"when\", \"we\", \"there\", \"can\", \"an\", \"your\",\n    \"which\", \"their\", \"said\", \"if\", \"do\", \"will\", \"each\", \"about\", \"how\", \"up\",\n    \"out\", \"them\", \"then\", \"she\", \"many\", \"some\", \"so\", \"these\", \"would\", \"other\",\n    \"into\", \"has\", \"more\", \"her\", \"two\", \"like\", \"him\", \"see\", \"time\", \"could\",\n    \"no\", \"make\", \"than\", \"first\", \"been\", \"its\", \"who\", \"now\", \"people\", \"my\",\n    \"made\", \"over\", \"did\", \"down\", \"only\", \"way\", \"find\", \"use\", \"may\", \"water\",\n    \"long\", \"little\", \"very\", \"after\", \"words\", \"called\", \"just\", \"where\", \"most\", \"know\",\n    \"get\", \"through\", \"back\", \"much\", \"before\", \"go\", \"good\", \"new\", \"write\"\n];\nlet counter = 0;\nlet lista = null;\nlet intervalId = null;\n\nfunction showRandomWord() {\n    if (intervalId === null) { \/\/ Start the timer on the first click\n        intervalId = setInterval(decrementTimer, 1000);\n    }\n    if (counter < 109) {\n        const randomIndex = Math.floor(Math.random() * words.length);\n        document.getElementById(\"wordDisplay\").textContent = words[randomIndex];\n        document.getElementById(\"clickCounter\").textContent = \"Number of Words: \" + (++counter);\n        lista = lista + counter + \" \" + words[randomIndex] + \"<br>\";\n    }\n}\n\nfunction decrementTimer() {\n    let timer = document.getElementById(\"timer\");\n    let timeLeft = parseInt(timer.textContent.split(\": \")[1]);\n    if (timeLeft <= 0) {\n        clearInterval(intervalId);\n        document.getElementById(\"randomWordButton\").disabled = true; \/\/ Disable button\n        document.getElementById(\"wordDisplay\").innerHTML = lista;\n        return;\n    }\n    timer.textContent = \"Seconds: \" + (timeLeft - 1);\n}\n\nfunction resetGame() {\n    clearInterval(intervalId);\n    intervalId = null;\n    counter = 0;\n    lista = \"\";\n    document.getElementById(\"timer\").textContent = \"Seconds: 60\";\n    document.getElementById(\"clickCounter\").textContent = \"Number of Words: 0\";\n    document.getElementById(\"randomWordButton\").disabled = false; \/\/ Enable button\n    document.getElementById(\"wordDisplay\").textContent = \"Click the button to start!\"\n}\n<\/script>\n<\/head>\n<body>\n\n<div style=\"text-align:center; margin-top:20px;\">\n    <H1 id=\"wordDisplay\">Click the button to start!<\/H1>\n    <button id=\"randomWordButton\" onclick=\"showRandomWord()\">Next Word<\/button>\n    <button onclick=\"resetGame()\">Start<\/button>\n    <div id=\"clickCounter\">Number of Words: 0<\/div>\n    <div id=\"timer\">Seconds: 60<\/div>\n    \n<\/div>\n\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Random Word Display with Timer and Counter Click the button to start! Next Word Start Number of Words: 0 Seconds: 60<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-6425","page","type-page","status-publish"],"_links":{"self":[{"href":"http:\/\/www.joapen.com\/jepc\/wp-json\/wp\/v2\/pages\/6425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.joapen.com\/jepc\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.joapen.com\/jepc\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.joapen.com\/jepc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.joapen.com\/jepc\/wp-json\/wp\/v2\/comments?post=6425"}],"version-history":[{"count":19,"href":"http:\/\/www.joapen.com\/jepc\/wp-json\/wp\/v2\/pages\/6425\/revisions"}],"predecessor-version":[{"id":6490,"href":"http:\/\/www.joapen.com\/jepc\/wp-json\/wp\/v2\/pages\/6425\/revisions\/6490"}],"wp:attachment":[{"href":"http:\/\/www.joapen.com\/jepc\/wp-json\/wp\/v2\/media?parent=6425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}