Normally any variable you define anywhere in an AL (except when using 'var' in a function body) is available everywhere else in that AL. This is because Javascript has global variables, and the entire AL has a single instance of the Javascript Engine.
The exception is scripted components, where each scripted component has its own Script Engine instance. As such, there is no sharing of variables between the AL and its scripted components.
So you pass data via Input/Output Maps, as well as setting parameters. And note that you can set any parameter value - it does not have to be a 'valid' one that is exposed in the Connection tab. This is another way to pass info between AL and scripted component.
A third option is via the properties of the JVM itself:
java.lang.System.getProperties().set(key, value)
where the 'value' can be any type of Java object, like an Entry or even a Javascript object.
Hope this helps!