JavaScript Input / Output mapping

The JavaScript module comes in very handy, if you want to quickly do think you are used to do in code (i.e. constraining / wrapping variables, make more complicated calculations, calculate dependencies etc…). But how do you integrate that module into a patch?
There are inputs on the left side and outputs to the right side. At the first sight it does not seem clear, how to return values from the JavaScript function to appear as outlets. But this basically is really easy: all you have to do is to return a JavaScript “Object”, that has the output-values attached as parameters. So, if you want to have a X and Y outlet, that create an Object, i.e. “Result” and create parameters X and Y at the result object. Fill the parameters with values and just return the object. In the init-line of the function you define the datatype and name if the single variables (__number X, __number Y).
The input side of that object is handled very similar. You define the input type and name of the input parameters. In our case we use an array to define the inputs.