1. Navigate to the Master Page Gallery (Site Settings -> under Web Designer Galleries -> Master Pages).
2. Select Files tab and then Upload Document.
5. Next specify the Name, Title, Description properties along with some special properties like “Target Control Type Standalone,Target Scope and Target List Template ID” for this new JS file.
There are three possible options
Target Scope - URL of the website this override applies to. This can be a relative path to your Site Collection or subsite.
For example, 107 would be the Target List Template ID for a Tasks List.
Once your done adding document properties Save it.
Don’t forget to Publish it as major Version before start using it.