How to access var from preceding javascript task in condition logic of current task

I have decided to do a workaround.

Instead of the condition logic checking if booleanVariable is true and the action only executing in that case, I throw an error in the javascript action if the booleanVariable is false and then the following action that would’ve had the condition logic simply only executes if the preceding javascript action succeeds.

However, the same problem still exists. I need to be able to access the value of a variable from the javascript action, in a following action. It is not clear if this is possible. I think the only way is to add it as an attribute  to either the task or result object, but it there is no documentation outlining this process.