const texts = [ "Gain skills that make you valuable in your career", "Build relationships that make your work and life better", "Have better communication that leads to more profits", "Plan priority tasks for short-term and long-term goals", "Actually do stuff that moves the business forward", "Manage people easily with a positive culture" ]; let index = 0; let charIndex = 0; let currentText = ''; let isDeleting = false; const speed = 50; const typewriterElement = document.querySelector('.typewritertext'); function type() { if (!isDeleting && charIndex < texts[index].length) { currentText += texts[index].charAt(charIndex); charIndex++; typewriterElement.innerHTML = currentText; setTimeout(type, speed); } else if (isDeleting && charIndex > 0) { currentText = currentText.substring(0, charIndex - 1); charIndex--; typewriterElement.innerHTML = currentText; setTimeout(type, speed / 2); } else if (!isDeleting && charIndex === texts[index].length) { setTimeout(() => { isDeleting = true; type(); }, 2000); } else if (isDeleting && charIndex === 0) { isDeleting = false; index = (index + 1) % texts.length; setTimeout(type, speed); } } type();