The best way would be to use the media folder. So, you will firstly need to create a folder called
media in your module folder.
Note: This folder should be created before installing, not after.
The inside the media folder, create 2 sub folders,
js. This isn't required but it's just nicer to keep things separate.
Then add the following to your XML file:
<media folder="media" destination="mod_EXAMPLE">
mod_EXAMPLE to whatever your module is.
Upon installation, the media folder will automatically be moved and you will end up with the following:
I know so far I have been referring to a module but the same applies for components too.
To call the file, you can add the following code to your default.php file for your extension:
JHtml::_('stylesheet', JUri::root() . 'media/mod_EXAMPLE/css/style.css'); // For CSS files
JHtml::_('script', JUri::root() . 'media/mod_EXAMPLE/js/script.js'); // For JS files
Hope this helps