This method is called an unobtrusive JavaScript link. This is one of the good practices for developing a web page with graceful degradation. Actual HTML does not contain JavaScript references, and JavaScript should not cause manipulation of the content.
Another reason JavaScript is included at the end of the file is because the web page may display without waiting for the JavaScript to fully load. This is the exact complement to why CSS files are included at the beginning (to prevent content from being shown before styles are set).
source share