You will need to get the location from a separate service/API. As far as I know, javascript doesn't have a geolocation feature just by itself.
In theory, this is something that should happen on the back end, whenever the request is being processed by the server, you should make the decision to show or hide the element. Otherwise, you will still display the element and it will hide after the country is verified by your external JS call, which could break at any point if your endpoint is not working correctly (since you don't control the service, there is a chance that this will happen).
In any case, here is an example from Stack Overflow on how to get the user's country:
How to get visitor's location (i.e. country) using geolocation?
After you get this you can just something simple like jQuery to hide your message.
Following this specific answer from Jonathan, you could adapt it to do something like:
$.get("https://api.ipdata.co?api-key=test", function (response) {
$("#myBanner").hide();
}, "jsonp");
This is the original answer:
https://stackoverflow.com/a/47135762/16101197
I hope this helps. :D