var index = 0; const label = "XOY"; const display = document.getElementsByClassName("display")[0]; function iterate_characters() { display.style.transform = (display.style.transform == "scale(2)") ? "scale(1)" : "scale(2)"; display.innerHTML = label.charAt(index); index = (index == label.length - 1) ? 0 : index + 1; } iterate_characters(); setInterval(iterate_characters, 1000);