js libraries work like this:
first you place the library/api/script. This will contain the rules and functions that make the feature work.
then you place your javascript. This javascript that you reference the above library with, changing rules or adding functions, etc.
The browser reads an html document from top to bottom. That’s why when there are two css rules to the same element, the css rule at the bottom is the one that is applied in the end.
scripts work the same way. You can’t reference a function that hasn’t been created yet, and the function can’t be created until after the browser has read the js file containing that function. Typically you will find “____ not defined as a function” errors in your console if this is your issue.
