For the best page load time and search engine optimization, it is best to load up JavaScript out of the root directory of the website instead of having it embedded on the page. JavaScript is a programming language that is used to run specific functions on the website. JavaScript that is used to insert dynamically generated content can make it difficult for the search engines to crawl and index that content so use JavaScript wisely.