Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let timeout = 200;
- let init = 1;
- let intervalId;
- function getBlock(number) {
- let grid = document.getElementById("grid");
- let str = String(number)
- return Array.from(grid.children).find(e => e.textContent === str)
- }
- function iterateNext() {
- let block = getBlock(init);
- block.dispatchEvent(new Event("tap"))
- init++
- if (init > 50) {
- clearInterval(intervalId)
- }
- }
- function run() {
- intervalId = setInterval(iterateNext, timeout);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement