+ 1

Document.addEventListener('DOMContentLoaded',( ) =>{

Explain me this syntaxe plz ?

15th Mar 2022, 5:45 PM
Izmiir
Izmiir - avatar
3 Respostas
+ 6
1.Document = who listens to event 2. addEventListener = method (in this case) of Document that adds a new reaction to an event. The method expects two parameters a) the Event (DOMContentLoaded) b) a function In this case the function is passed as a function without a name and without parameters. ( ) => {function body} This kind of functions without name are arrow functions.
15th Mar 2022, 6:17 PM
Oma Falk
Oma Falk - avatar
+ 5
After Oma Falk 's explanation, I just want to add one thing that; DOMContentLoaded event is initialised when the entire HTML document is loaded. Thanks. Happy Coding 🤠
15th Mar 2022, 6:27 PM
Adil
Adil - avatar
+ 1
Oma Falk DOMContentLoaded ?
15th Mar 2022, 6:35 PM
Izmiir
Izmiir - avatar