'What is exactly the event object? [duplicate]

What is an event object? When is it executed? Why do we have it? For example:

  1. when we use an anonymous function as in this example, the event object will not be renderPosts() function.

    window.addEventListener('DOMContentLoaded', () => renderPosts());
    
    const renderPosts = async () => {
      let uri = 'http://localhost:3000/posts?_sort=likes&_order=desc';
      const res = await fetch(uri);
      const container = document.querySelector(".blogs");```
    
    
  2. when we do not use anonymous function as in this example, the event object will be renderPosts() function.

    window.addEventListener('DOMContentLoaded',renderPosts());
    
    const renderPosts = async () => {
      let uri = 'http://localhost:3000/posts?_sort=likes&_order=desc';
      const res = await fetch(uri);
      const container = document.querySelector(".blogs");```
    
    
    

I do not see the difference and not really understand it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source