To call a JavaScript function you have to attach an event handler to that function. The handler starts the function if a defined event is fired.
Open Form Properties
Select the form you like to run JavaScript function and open form properties.

Add the Library
In the section Form Libraries select the library where you defined the function.
Select Event Handler
In the section Event Handlers select the component and event on which you want to attach the handler. For example if you choose the component Form and the event OnLoad the function will get started if you open the form.

Add the Function
Select the library and write the name of the function without parentheses. If you choose to Pass execution context as first parameter you have to define a parameter in the function where the context object will be passed. The executionContext object is an part of the Client API you’ll need if you want to access components like form fields or labels.