Solution:
Please see all the parameters of wp_enqueue_scripts
Try below code :
/**
* Proper way to enqueue scripts and styles
*/
function myFunction() {
wp_enqueue_style( 'style-name', get_stylesheet_uri() );
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'myFunction' );