How to compare two array lengths and execute a function?
There are two arrays, if in two arrays the length is more than one, then the function is executed, if in some of them the length becomes equal to 0, stop the running !!!
How can this be done?
function start() { document.getElementById('ok').innerHTML = '<div>Длина двух массивов больше 0</div>' //Функция запуска } function stop() { document.getElementById('ok').innerHTML = '<div>Какойто из массивов равен 0</div>' // Остановить запущенную функцию если какой-то из счетчиков стал равен "0" //и ждать изменения если оба счётчика станут равны больше "0" } function liki() { const ids = [...document.querySelectorAll('#user uidm')].map(uidm => uidm.attributes.uid.value); if (ids.length > 0) {} const idss = [...document.querySelectorAll('#user uid')].map(uid => uid.attributes.uid.value); if (idss.length > 0) {} }
остановить запущенную
? - Air