I have some Javascript code that creates three cluster layers.
I need to be able to clear the three layers (workLayer, educationLayer, volunteerLayer) when I start a new process but can't figure out the right function.
This is what I have but it leaves the layers / graphics there.
function clearLayers() {
[workLayer, educationLayer, volunteerLayer].forEach(layer => {
if (layer.source) {
layer.source.remove()
}
});
}