In order to get our JavaScript file loaded, it needs to be in a library and attached to something. As you learned in Chapter 4, Theming, the libraries file has the name hello_world.libraries.yml and is located in the root folder of our module:
hello_world_clock: version: 1.x js: js/hello_world_clock.js: {} dependencies: - core/jquery - core/drupal - core/jquery.once
We only have a single JavaScript file that is needed for our purpose, located in the js directory of our module. But we do have some dependencies. First, we want jQuery loaded because we will use it. Second, we want to have the general Drupal JavaScript library, which handles a bunch of things, including behaviors. The last dependency we will talk about soon and it ...