Un código simple para una necesidad simple.
<!DOCTYPE html>
<html lang="es">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Juego Secreto</title>
    <style>
      body {
        background-color: LightSteelBlue;
      }
    </style>
  </head>
  <body>
    <input />
    <button>Mostrar texto escrito</button>
    <script>
      // variables ------------------------------>
      var input = document.querySelector("input");
      input.focus();
      // funciones ------------------------------>
      function mostrarTexto() {
        alert(input.value);
        input.value = "";
        input.focus();
      }
      // programa ------------------------------->
      var button = document.querySelector("button");
      button.onclick = mostrarTexto;
    </script>
  </body>
</html>