JQuery help in fixing console error

Please advise what needs to be done to fix this console error:

The error is generated in the following page:
https://www.tkkinter.com/en/product/no-ant-service/

Under "FAQ", when you click the accordions, you'll notice the console error.

This is the code which is implemented via Custom JS plugin:

var acc = document.getElementsByClassName("accordion")[0];
var i;

for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var accpanel = this.nextElementSibling;
if (accpanel.style.maxHeight){
accpanel.style.maxHeight = null;
} else {
accpanel.style.maxHeight = accpanel.scrollHeight + "px";
}
});
}

Please check the chat notes for more info.