toggle class by document javascript code example
Example 1: jquery toggle class
$( "#foo" ).toggleClass( 'className', addOrRemoveOptional );
Example 2: how to change class by is in js by toggle
<button class="" id="changeicon">
<i id="slideshow" class="fas fa-hamburger"></i>
</button>
$("#changeicon").click(function() {
$("#slideshow").toggleClass("fa-times");
});