Magento 2 brings some new features in javascript. One of them is “requireJS” (javascript file loader) and second is “jQuery“, a very popular js library. One of the biggest benefits is using requireJS which means that Magento 2 is ready for the upcoming HTTP2 protocol.
1) Place your requirejs-config.js file in one of the following directories (according to the location of your custom script):
Your theme files: <theme_dir>
Or
Your module view files: /view/frontend
requirejs-config.js
var config = {
"map": {
"*": {
"menu": "js/navigation-menu"
}
}
};
2) Load your js files in your template files
<script type="text/javascript">
require([
'menu'
], function(menu){
$(document).ready( function() {
//Do your actions here
});
});
</script>
Refer this Magento Dev Docs for more information https://devdocs.magento.com/guides/v2.3/javascript-dev-guide/javascript/custom_js.html
For loading CSS, you can directly load it through layout XML file
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
<head>
<css src="css/mycustomcss.css" />
</head>
</page>