how to toggle class of parent onclick in javascript code example

Example: how to toggle class of parent in javascript

/* HTML */

/*
<div class="tab-links closed">
	<a class="tab-links__link" onclick="toggleLink(this)"></a>
    <a class="tab-links__link" onclick="toggleLink(this)"></a>
    <a class="tab-links__link" onclick="toggleLink(this)"></a>
    <a class="tab-links__link" onclick="toggleLink(this)"></a>
</div>
*/

const toggleLink = (element) => {
 element.parentNode.classList.toggle('closed');
}