How do I check if a relationship panel is populated for an entity from JS to have some front end validations.

I have an entity A with a relationship...