If we try to access DOM objects before it is loaded, we can have problems. Is it proper to write ALL JS code inside an eventListener of type 'DOMContentLoaded'? Is there anything that is more appropriate to leave out? Excuse me, but I'm a beginner and this is a question that, no matter how obvious it may seem to a veteran, worries and confuses me.
I don't know what you mean by
"adecuado"
, but with DOMContentLoaded, you always make sure that the document has been loaded, BUT not completely because it doesn't take images or style sheets into account, although contradictorily many times it does work, because most of the time it does load everything, instead load expects you to load absolutely EVERYTHING, as the MDN says: