WordPress lets you register your own script files with your theme or plugin instead of hardcoding a <script> tag into your header or footer. The traditional approach loads scripts unconditionally on every page, whether they’re needed or not, and gives WordPress no way to manage load order or avoid duplicate copies of the same library. Registering scripts with wp_register_script() (and loading them with wp_enqueue_script()) lets WordPress handle dependencies, versioning, and placement for you, which keeps your site faster and your script loading predictable.
So how do you register a script?
Use the following syntax to register a script. This is typically called inside a function hooked to wp_enqueue_scripts (more on that below).
wp_register_script( $handle, $src, $deps, $ver, $in_footer );
Continue reading Working With wp_register_script()