const el = document.getElementById('num') const time = (num, t) => { setTimeout(() => { el.style.height = num }, t) } setInterval(() => { time('80%', 0) time('50%', 1000) time('20%', 2000) }, 3000)