InnerHTML undefined JavaScript Meaning

So I am creating a website for myself and I am using JavaScript to create a decrypting animation. I keep getting the error innerHTML is undefined and I am having trouble figuring it out. The JavaScript code is:

function decrypt(){
    var name = document.getElementsByClassName("name")[0];
    var char = name.getElementsByClassName("chars");
    for (var i = 0, j = name.children.length; i <= j; i++) {
      var compareChar = char[i].innerHTML;
      if(compareChar != message[i]){
        let randomNum = Math.floor(Math.random() * message.length); 
        char[i].innerHTML = message[randomNum];
      }
      else {
        document.getElementsByClassName("chars")[i].style.borderColor = "black";
        document.getElementsByClassName("chars")[i].style.backgroundColor = "black";
        }
    }
}

The innerHTML part of the line: var compareChar = char[i].innerHTMLis giving me the innerHTML defined error. Any help would be appreciated, been stuck on this for a while now.