There is no real message that will tell you that your computer is hacked. There are 2 common forms of this scam with the one you saw being an advertisement from a web page that will pop up and try to get you to install some software or call a number claiming to be Apple. What the message says and the action they want you to take changes all the time.
The other form of this scam is a Notification that appears in the upper right of your computer that will say it is infected. This one usually wants you to sign up for some software program that claims it will fix the problem.
While both of these are scams, how you deal with them are different. In your case the ignore and move on approach will be enough. Although visiting that same website may show that same ad and also the less than legitimate sites are more likely to use the fake ads. The other Notification scam happens when a user allows Notifications from a bad website and all you have to do is remove the Notification at Safari > Settings > Websites > Notifications.
Again Apple will never show you a message that your computer has been hacked and anyone that does is trying to get information or money from you. You may also see similar scams in messages and reviewing this Support Article may help:
Recognize and avoid phishing messages, phony support calls, and other scams - Apple Support