Pure Javascript equivalent to jQuery $(document).ready()

The pure Javascript equivalent to

$(document).ready(function() {
    // Your code goes here!

})

is

document.addEventListener("DOMContentLoaded", function() { 
    // Your code goes here!
});

Note that it’s not supported by IE8, but that should not be an issue in 2019.