For just forever, I have been wrapping page load javascript inside an anonymous function (a pattern I learned from numerous examples right here on SO) like this:
<html>
<script>
    (() => {
        // do page load stuff here.
        document.getElementById("someId").style.color = "blue";
    })();
</script>
</html>
But this does the same thing:
<html>
<script>
    // do page load stuff here.
    document.getElementById("someId").style.color = "blue";
</script>
</html>
The script is going to run regardless, so what is the point of the outer anonymous function wrapper, and when would I use one and when would I not use one?
