I found this example on w3schools about js callbacks. It's supposed to output "Goodbye". My question is why isn't "hello" printed first since myFirst() is the first function call followed by mySecond? The code snippet is attached below.
function myDisplayer(some) {
document.getElementById("demo").innerHTML = some;
}
function myFirst() {
myDisplayer("Hello");
}
function mySecond() {
myDisplayer("Goodbye");
}
myFirst();
mySecond();
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Function Sequence</h2>
<p>JavaScript functions are executed in the sequence they are called.</p>
<p id="demo"></p>
</body>
</html>
innerHTML += someinstead.