**This answer is very long and has many methods, best is at the bottom**

`unset($doc->_scripts[JUri::base(true)'/path/to/file.js'])`

is mostly how to do it, some scripts might add the full url and some might not.

So here is a better way to go about it if you want everything removed.

    $doc->_scripts = array();
    //if you need to re include libraries
    JHtml::_('jquery.framework');
    JHtml::_('behavior.framework');
    
    //if the array trick does not work you could do
    for($i=0;$i<count($doc->_scripts);$i++){
       //in here you could stop it from removing specific files by looking for specific file names
       $get_file = explode('/',$doc->_scripts[$i]);
       $get_file = end($get_file);
    
       //many more ways to do this, chains of if statements can get messy
       switch($get_file){
          case 'jquery.js':
          case 'boostrap.js';
             break;
          default:
             unset($doc->_scripts[$i]);
             break;
       }
    }

EDIT:

For script declaration it combines most scripts into one rather then seperate them, also the template is not the last place to execute before the page is rendered, so more could still be added to the script array. I am not 100% on this but I believe modules are rendered after the template and then inserted, components load based on the menu item so they load before. Also plugins can add more scripts afterwords.

So the only way to guarantee that you can adjust the scripts to your needs fully would be through a plugin. There is a system event called `onBeforeCompileHead` that can do that.

http://docs.joomla.org/Plugin/Events/System#onBeforeCompileHead

You would have to create a plugin but they are the easiest of all extensions to make, here is a good reference.

http://docs.joomla.org/J3.x:Creating_a_Plugin_for_Joomla

**In Summary, depending on where it is added it may not be possible in the template, plugins could be the only way.**

UPDATE
Like I said it cannot be done with just templates, but I found a way to get around that with a simple system plugin that can be used to allow it on any site. This is something that would be useful in the core and I might try to do a pull request to get it added, though anyone is welcome to. However its unlikely to be added "next release"

    class PlgSystemHooks extends JPlugin
    {
    	public function onAfterDispatch(){
    		$app = JFactory::getApplication();
    		$template = $app->getTemplate();
    
    		if ($app->isSite())
    		{
    			if (file_exists(JPATH_THEMES.DIRECTORY_SEPARATOR.$template.DIRECTORY_SEPARATOR.'functions.php'))
    			{
    				$dispatcher = JDispatcher::getInstance();
    				require_once JPATH_THEMES.DIRECTORY_SEPARATOR.$template.DIRECTORY_SEPARATOR.'functions.php';
    			}
    		}
    	}
    }

This is sort of inspired by wordpress but I was blown away when, by looking at source code I discovered it was basically completely supported in core, just the final step of defining a file in the template was missed. Such a useful functionality!

Here is how to use it.

First create a `functions.php` file in your template.

Next use something like this in that file.

    $dispatcher->register('onBeforeCompileHead',function(){
       //your code to remove the unneeded scripts.
    });

This can be very useful in many projects that need some simple plugin functionality specifically for that site, but making a custom plugin is way more work then it needs to be.