"Javascript" does not have anything like that. I guess you mean the "Browser" and its DOM Apis.
I would argue, that it due to the "dynamic" nature of Webpages, you can never be 100% sure, that the page has not an async request idle somewhere.
For process automation, I would assume that:
https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
window.addEventListener("load", (event) => {
// do something to signal the automation bot that everything is loaded.
});
is the best bet. In order for this to work, you will have to be able to access the browsers DOM tree, and injecting your own scripts. This might not be possible with the automation framework.
If the next automation step relies on a specific element to be loaded - this element should be directly targeted.