In Jquery, we can see two ways of writing: $ (function () {}) and $ (document) .ready (function () {}), both execute a function
window.onload after the dom document tree is loaded A function
is executed after the dom document tree is loaded and all files are loaded, that is, $ (document) .ready is executed before window.onload.