`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;
       }
    }