Why is the function working without the content?

Im wondering about the function which is empty and I dont call the function "myFunction();. But the function still works. Just wondering why. I thought, to run the function, it needs content in order to work. Obviously the function can be empty and does not need to be called with myFunction(); right? https://code.sololearn.com/WJVjQR5K51C5/?ref=app

8th Feb 2022, 9:35 PM
CodeX - avatar
1 Answer
You didn't need to put the statements document.getElementById("my-div").innerHTML += " John"; document.getElementsByClassName("par")[0].innerHTML += " additional Input 1"; document.getElementsByClassName("par")[1].innerHTML += " additional Input 2"; inside a specific function like your function which is called myFunction because each statement run by default when the complier arrive the line of code of it's
8th Feb 2022, 10:11 PM
Muhammad G
Muhammad G - avatar