How to call JS in your wordpress plugin

Javascript is really an amazing think, when you are developing any website with good animation, call value without page loading etc.
Wordpress already call latest jquery when call wp_head() function in header.php, but sometimes you want to add own script in plugin. wp_enqueue_script is then useful for you.

<?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?>

$handle : (string) (required) Name used as a handle for the script.

$src : (string) (optional) URL to the script, e.g. http://example.com/wp-content/themes/my-theme/my-theme-script.js.

$deps : (array) (optional) Array of the handles of all the registered scripts that this script depends on, that is the scripts that must be loaded before this script. Set false if there are no dependencies.

$ver : (string) (optional) String specifying the script version number, if it has one, which is concatenated to the end of the path as a query string.

$in_footer : (boolean) (optional) Normally, scripts are placed in of the HTML document.

<?php
function my_scripts_method() {
	wp_enqueue_script( 'my-script-name', get_template_directory_uri() . '/js/script.js', array(), '1.0.0', true );
}

add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
?>