Your code changes CSS properties on #mobile-menu, which I’m going to assume is correct. What we need to see is the code that actually calls the CloseMobileMenu() function. Or are you asking how to do that?
This will work when they click the close button but it won’t work if they click outside the dialog. You would generally do that by adding a click handler on the body when the dialog is opened and then calling CloseMobileMenu if the click was not on the dialog.
But I am just guessing here because I don’t know what you have done so far.
I see you have been a member here for quite a while but you say you have no experience in JS, so it sounds like you haven’t completed the JS module here at FCC? Have you considered trying that? There are a ton of good beginner’s books on web development out there as well.
As for the code you have posted, clicking the button should hide the element with id mobile-menu. But I’m still not sure I understand what else you want to do.
As I mentioned above, you would add a click handler on the document when the dialog initially opens and then close the menu programatically if the click is not on the menu itself.