There is a code:
/*Присваиваем метки*/ let label = 0; function setLabel(y, x) { setTimeout(function() { matrix[y][x].label = label; setDivLabel(y, x, label); console.log(matrix[y][x].label); label = label + 1; if (validCell(y - 1, x) && checkCell(matrix[y - 1][x])) { setLabel(y - 1, x); } if (validCell(y + 1, x) && checkCell(matrix[y + 1][x])) { setLabel(y + 1, x); } if (validCell(y, x - 1) && checkCell(matrix[y][x - 1])) { setLabel(y, x - 1); } if (validCell(y, x + 1) && checkCell(matrix[y][x + 1])) { setLabel(y, x + 1); } label = label - 1; }, 500); } setLabel(io.enter[0], io.enter[1]); When performing the label at each iteration of 0. Why so, please tell me?
else if? .... - meine