Advised to put JS at bottom of page (not header) to increase loading times

My firefox plugin called yslow that gives advice on speeding up loading times says:
JavaScript scripts block parallel downloads; that is, when a script is downloading, the browser will not start any other downloads. To help the page load faster, move scripts to the bottom of the page if they are deferrable.

I always thought that js should be in the header. What do you think? Thanks

When possible placing JavaScript before the closing body tag is best practice considering the content of the page will not be dragged down by any JavaScript that needs to load. The JavaScript can load after all the content is available. So yes, it is considered proper practice to place it before the closing body tag – when possible. Moe important than that though is to serve it all up in as few requests as possible ie. try to avoid excessive script tags unless absolutely necessary – most likely the case of vendor or third party code.

Thanks oddz for clearing that up. Very interesting I always put it in the head- now I know better!

Most JavaScript single threads while other files can download 8 files at a time. So scripts in the head will delay 8 threads woth of file downloads while delaying the script to the end of the body means that only that one file (which probably can’t run until the rest of the HTML has loaded anyway) is delayed in loading. So the rest of the page loads a lot faster. With the script at the bottom you can simplify the script as well because you can get rid of all the tests for whether the page has loaded yet. Effectively this means that the script can start running a lot sooner as well.