Javascript Loading Effect to URLs

I added the Javascript file with the following code.

So if anyone is looking for this solution should use the below code in functions. I don’t know who was so jobless to vote this question down but I am trying to fix my mistake of posting question here on stackexchange by answering my own question.

add_action( 'wp_enqueue_scripts', 'gen_progressbar');
function gen_progressbar() {
  wp_enqueue_script( 'custom-script', get_stylesheet_directory_uri() . '/js/gen-progress.js', array( 'jquery' ) );
}