Home>

I don't know which language can be written, but the characters are
i
hg
sjs
kshs
abcde
I want to write a code that changes in order and is overwritten. It feels like roulette.

(I posted it in the middle due to an operation error, but I can say it in a hurry) I tried to write it by using the while statement, but it turned out to be no output. Also, I can't write code to display characters in the same place (left-justified) while changing them at high speed, and only the last one is output, or all are output in different places.

The language can be CSS or Python. I understand Python better, but I wondered if JS was more suitable.

I didn't intend to post it yet, but when I first used it on my smartphone, I touched the post button ... I'm sorry. Excuse me in a hurry.

  • Answer # 1

    <script>
    var timerID;
    const txt = ["i", "hg", "sjs", "kshs", "abcde"];
    timerID = setInterval (() =>{
      document.querySelector ('# view'). textContent = txt.shift ();
      if (txt.length == 0) clearInterval (timerID);
    }, 300);
    </script>
    

  • Answer # 2

    I want to write code that will be overwritten.

    WhatThe biggest problem is to display the result. For exampleconsole.logCannot overwrite what was output once, so it cannot be handled.

    On the contrary, if it is a place where "it will be overwritten if it is output normally", I think that there is almost no problem.