You could do something like this:
Version 1: using transitionend event
const myArray = [
        "text1",
        "text2",
        "text3",
        "text4",
        "text5"
      ],
     container = document.querySelector("h1"),
     transitionEndEvent = whichTransitionEvent();
let i = 0;
(function loop() {
  // Add the "hide" class
  setTimeout(()=> container.classList.add('hide'), 0);
  // Wait for the animation to end
  addEventListenerOnce(container, transitionEndEvent, () => {
    // Change the text
    container.innerHTML = myArray[i];
    // Remove the class
    container.classList.remove('hide');
    // Wait for the animation to end
    addEventListenerOnce(container, transitionEndEvent, () => {
      i = ++i % myArray.length;
      // Show the text for 1 second and continue
      setTimeout(loop, 1000);
    });
  });
})();
// Just a utility function to trigger an event handler once
function addEventListenerOnce(el, eventName, callback) {
  el.addEventListener(eventName, handler);
  function handler() {
    el.removeEventListener(eventName, handler);
    callback.call(el);
  }
}
// The name of the event depends on the browser
function whichTransitionEvent(){
  var t, el = document.createElement("fakeelement");
  var transitions = {
    "animation"      : "transitionend",
    "OAnimation"     : "oTransitionEnd",
    "MozAnimation"   : "transitionend",
    "WebkitAnimation": "webkitTransitionEnd"
  }
  for (t in transitions){
    if (el.style[t] !== undefined){
      return transitions[t];
    }
  }
}
h1{
  opacity: 1;
  transition: opacity 300ms;
}
.hide {
  opacity: 0;
}
<h1></h1>
 
 
About the whichTransitionEvent function
Browsers have different names for the transitionend event. This utility function will select the right one for the current browser. I found the inspiration for it here.
About the loop function
As you can see, that function is wrapped in (function loop() {...})();. That is called an IIFE (Immediately-Invoked Function Expression). We call the function as we're declaring it. In this case, it will also call itself recursively.
About the i = ++i % myArray.length; line
Here, we're using the modulo operator to make things shorter. But it's equivalent to this:
i++;
if (i >= myArray.length) { i = 0; }
Version 2: using setTimeout
Unlike the version above, you'll need to manually edit the animation duration in the JS if you do change it in the CSS. But it removes a lot of code:
const myArray = [
        "text1",
        "text2",
        "text3",
        "text4",
        "text5"
      ],
     container = document.querySelector("h1"),
     animationDuration = 300; // in milliseconds
let i = 0;
(function loop() {
  // Add the "hide" class
  container.classList.add('hide');
  // Wait for the animation to end
  setTimeout(function() {
    // Change the text
    container.innerHTML = myArray[i];
    // Remove the class
    container.classList.remove('hide');
    // Wait for the animation to end
    setTimeout(function() {
      i = ++i % myArray.length;
      // Show the text for 1 second and continue
      setTimeout(loop, 1000);
    }, animationDuration);
  }, animationDuration);
})();
h1{
  opacity: 1;
  transition: opacity 300ms;
}
.hide {
  opacity: 0;
}
<h1></h1>