Is it possible to remove a function within a function with an event listener?

I’m currently doing The Odin Project Webpack Restaurant Project. I’m focusing on Tab Switching, I had an idea that maybe with an event listener. I can remove a specific function within another function and replace it. So let’s say, |

I have a main container function, inside that main function. I can call other functions to display html content such as home, about, menu, etc…

I click on the about link. It will take out the home() and replace it with about(), which will now display abouts html content to the screen.

OR

should I call all the functions inside that mainContainer but when clicking on a link or tab, it will give it a style of seen and the others will be given hidden.

This is just me brainstorming on how I’m going to approach the problem. Just want to see if it’s possible for the first one. If not, I’ll do the second option I thought of.