[SOLVED]-Tic Tac Toe reset problems

Hi guys… it ii over 1 week i start this challenge and i think this is the most difficult since i start with FCC…
I still have problem with my Computer AI…but what i dont’know it this:
if i play a 2 players game everything its ok when i reset for next match…but if i play against computer, when i click “next game” button after a match it start with the last games moves…even if my reset function its called…and it reset every array exept the possible wins arrays…
this is my code…someone can help me???

Hi Laguno, I don’t exam in depth your code, but accordingly to what i’ve seen when fired the reset ‘button’ after playing against the computer, i will say, you probably not clear the computers moves. In which variable do you store the computer moves or playes moves? .
And now, you are using setInterval, i will recommend to use setTimeout instead which excuted just once. setInterval call your function repeatedly. So when you reset the game, and you want now the computer to play first, setInterval just call the computer every second and put all the previous stored position without waiting you to pay.

when your game resets it goes through your reset function then goes in the disegnaSegno function and jumps back and forth through the code below … and on each iteration it adds the computor moves to the screen … so debug these and you find out whats going on that you dont want to happen

  $("div.quadrato").each(function(element) {
    if ($(this).text() == item.toString()) {
      var c = $(this);
      setInterval(function() {
      }, 1000);

line num 27) function computerMove() { 
line 35)
 ```if (checkAvailability(5)) {
      setInterval(function() {
      }, 1000);```

thank you very much to @KKOL and @JohnL3…the problem was the setInterval insted setTimeout…now the reset works …
I just have to finish the AI and after i can start with the next challenge…for now my AI its very stupid…