Js timer cannot be cleared in WeChat Work H5 interface

this code may be fine in the browser, but on the H5 interface on the mobile side, the loop will always fail to stop

            function zhuajiu(userid) {
                var timesRun = 0;
                var ran = 0;
                var time = setInterval(function() {
                    ran = Math.random() * 100; //[0,range)
                    var result = parseInt(ran); //
                    $(".lotid").html(result);

                    timesRun += 1;
                    if(timesRun === 10) { 
                        alert(11);
                        clearInterval(time);
                    }

                }, 50);



            }

Thank you for your help. A global variable has been contaminated.

May.22,2021

seems strange. I misread


. Is there a recurrence address? Has it been called repeatedly? Pull out a separate page, is there the same question? Add a vconsole, to the


page to add alert (11); replace it with console.log (timesRun); or consider remote real machine debugging; in addition, if (timesRun = 10) I think it seems safer to write this as if (timesRun > = 10).

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-1e4c888-44eb0.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-1e4c888-44eb0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?