Hide Google Maps element when Database is empty

On my Dynamic Pages I have a Google Maps element, connecten to Longitude/Lattitude text fields in my database. Some of my Dynamic Pages don’t have a location. When the Longitude/Lattitude text fields aren’t filled I’d like to hide the Google Maps element. Is there a simple code for this?

Thanks!!

let itemObj = $w("#dynamicDataset").getCurrentItem();
let lat = itemObj.latitude;
if(lat === undefined) {
   $w("#googleMap").hide()'
}

Thanks a lot! However, it doesn’t work yet. I tried to set the lattitude/longitude both as textfields as numbered fields but both don’t seem to work. Any idea how come? Thanks again.