Inline Small JavaScript Files
Inline JavaScript is a advanced technique to speedup your website.Put your JS into HTML file instead of keeping it on external JS file.So,it will reduce the files the browser has to download and display user requested page.Many developers apply inline JavaScript for website homepage only.Because of it has to be load fast.For rest of the website pages,they use several external JavaScript files.This is really not good for pagespeed,so prefer inline JavaScript for entire site.
If you use an external JS file,than browser first loads HTML file and again it lookups to download files from external JS files.Server getting extra requests from the browser,your website takes some extra ms to display page,it has to take time to download files.
How to Inline JavaScript
To Inline Small JavaScript,you need not to work hard,it's pretty simple method.First copy the content of external JS file and paste it in your HTML file.This code should be added between script tags in head section as shown in below.
<script type="text/javascript">// <![CDATA[
PASTE YOUR JAVASCRIPT CODE HERE
// ]]></script>
Putting your external js file content into head section of your HTML file is not only reduces extra file but also saves time to browser to download files from one js only.It's a best practice to reduce the server time.After implementing this technique just checkout your page speed in Google page speed and YSlow.The code should be added properly in order to get success of Inline JS.If you are using WordPress,then your site might have more than 3 to 5 external JS files,simply copy them all and paste in between scripts tags in HTML section.