About the problem of setInterval timer execution trigger?

my code is as follows:

var downH = document.querySelector(".down");
var anmin = 0;
function anminDown() {
  if (anmin < downH.offsetHeight) {
    anminPP;
    downH.setAttribute("style", "bottom:" + -anmin + "px");
  } else {
    clearInterval(timer);
  }
};
var timer = setInterval(anminDown, 50);
// document.querySelector(".meun").addEventListener("onmouseenter", function () {
//   anminDown;
// });

Why does the timer run automatically? There is no place in the code to call it

Jul.19,2022

executes to var timer = setInterval (anminDown, 50); does these things:
1, declare a variable timer with the value undefined
2, call the setInterval method, notify the runtime, execute anminDown
3 at 50 millisecond intervals, assign the return value of setInterval to timer

obviously, your code has told the browser to execute anminDown ;

every 50 milliseconds.

solution, add a start function, call when you need to start:

var cancelToken = null;

......

function start() {
   cancelToken = setInterval(anminDown, 50);
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-7b9523-131a4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-7b9523-131a4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?