//How to load function after the page has loaded? window.addEventListener('load', function() { console.log('All assets are loaded') })