Hide a map with no address

Maybe this would help

$w.onReady(function () {
    $w('#dynamicDataset').onReady(() => {
        const item = $w('#dynamicDataset').getCurrentItem();
        if (!item.columnnameofaddress1) {
            $w('#Address1').collapse();
            $w('#googlemaps1').collapse();
            // this console.log is used for checking if the code is working
            console.log("address1 is empty");
        }
        if (!item.columnnameofaddress2) {
            $w('#Address2').collapse();
            $w('#googlemaps2').collapse();
            // this console.log is used for checking if the code is working
            console.log("address2 is empty");
        }
        if (!item.columnnameofaddress3) {
            $w('#Address3').collapse();
            $w('#googlemaps3').collapse();
            // this console.log is used for checking if the code is working
            console.log("address3 is empty");
        }
    })
});