Customizing "Page doesn't exist" page

I was able to customize the message with a little Javascript:

window.addEventListener("DOMContentLoaded", function(){
    document.querySelector('.page-not-found .title').innerHTML = "NEW MESSAGE HERE";
});

The script replaces the HTML where the ‘Oops! That page doesn’t exist or is private’ is located. I haven’t tried it, but in theory, you could add HTML to render a picture.