Check if an entity has been selected

I bet this is a really trivial thing to do, but I can't figure it out. Let's say there are 3 or 4 entities on the map (in my case they are points). I just need the if statement that would check if one of the entities is selected.

if ("entity is selected") {
      
      var entity = viewer.selectedEntity

      Do Something
}

Hello,

You can do if (Cesium.defined(viewer.selectedEntity))

selectedEntity is undefined when no entity is selected.

Best,

Hannah

THANK YOU