How to use JavaScript to get element by class name and then split commas onto new lines?

Let’s say I have this HTML output:

John Doe, MD

Use vanilla javascript to add / remove class to a different element after clicking on another one

I have looked through a number of similar questions but can not find a specific example of one that answers in vanilla JS how to add and remove a class to a different element from the one clicked on. …