Grace Hopper wrote the first compiler ever written, at least in this world. I wonder what she would say. I think she would encourage you to look closer.
The error message is saying that classList is undefined. You don’t show us what element the message is complaining about. Perhaps you can (in the code) just check if classList is undefined before doing the add; if it is undefined then it is probably not possible to use a CSS class on the element.
Note to others: look at the image to see why I mention Grace Hopper.