Use a plugin to load JS files
<?php
/**
* Plugin Name: Plugin Name
* Plugin URI: http://solidpixel.com
* Description: Description
* Version: 1.0.0
* Author: Pelly
* Author URI: http://solidpixel.com
* License: GPL2
*/
function yt_custom_scripts() {
wp_enqueue_script( 'custom', plugins_url() . '/plugin-folder/js/custom.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'yt_custom_scripts' );