Hooks allow modules to alter and extend the behavior of Drupal core, or another module. They are one of the various ways that code components in Drupal can communicate with one another. Using hooks a module developer can change how core or another module works -- without changing the existing code.
To remove the version query string from all JavaScript files, you can modify the MYMODULE_js_alter() implementation to loop through all the JavaScript files in the $javascript array and set the version to NULL for each file. Here's an example implementation: