I have a very simple question. How do I simply remove a layer with a switch function? My below function adds the layer twoYear to the map but doesn't remove the sixMonth.
switch (layerSwitchValue) {
case "6Month":
break;
case "2year":
map.addLayers([twoYear]);
map.removeLayers([sixMonth]);
break;