Home Is there an easier way to repeat multiple lines of code JQUERY
 I have multiple functions that use different elements to perform the same task. This is for a mobile menu. So I have a function that when menu button is clicked..open mobile menu, transform hamburger to an "X" and make the page overlay visible. I also have a function that closes the menu when the menu is open and the user changes the orientation of the device. I also have a function when the user clicks/taps anywhere outside of the mobile menu it will close the menu (as well as clicking "X"). In these functions I repeat myself a lot, using "removeClass or toggleClass". Is there an easier way to represent all of these lines of code so that they're declared once somewhere else and then called within all of these functions? A variable maybe? Because I don't like repeating myself. This is the repeat/example code. $("#mobile-menu").removeClass("enabled1");$("#menu-button").removeClass("open"); $("#mobile-menu-wrapper").removeClass("enabled1");$("#page-overlay").removeClass("enabled1");