I'm facing a challenge with a paragraph element that is dynamically filled with content using Javascript. I need to hide the element whenever it doesn't have any text within it. However, I want to avoid using setTimeout or setInterval for this task. Also, creating a separate function and calling it in every other function isn't feasible due to the high number of functions that manipulate the content of my paragraph element. Can anyone suggest the most effective approach to achieve this?