What is an event object? When is it executed? Why do we have it? For example:
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");```
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.