Main reason for using this function is to load .js scripts only on pages required via the functions.php page.

function wpt_theme_js(){

if(is_page_template( 'page-contact.php' ) ){
wp_enqueue_script('template_js',get_template_directory_uri().'/js/template.js','','',false);
}
}
add_action('wp_enqueue_scripts','wpt_theme_js');

Note: Function will not work as a stand alone.