Add .js Files To Child Theme

Load a Script from a Child Theme without any dependencies
  1. Add a js directory to Child Theme
    Something like: urbannews-child/js/
  2. Add js files.
    For example: urbannews-child/js/cactus-themes.js
  3. Add this code segment with the structure as follows in urbannews-child/functions.php file to load a Script from a Child Theme

add_action( 'wp_enqueue_scripts', 'cactusthemes_child_add_scripts' );

/**
* Register and enqueue a script that does not depend on a JavaScript library.
*/
function cactusthemes_child_add_scripts() {
wp_register_script(
'cactusthemes-child',
get_stylesheet_directory_uri() . '/js/cactus-themes.js',
false,
'1.0',
true
);

wp_enqueue_script( 'cactusthemes-child' );
}
?>