5.1.0.M2, JS does not store any data

I have never said it’s undocumented for Script Conditions. It is however undocumented for Script Actions. FYI this is how the docs look like:

(JavaScript Scripting - Automation | openHAB)

There was, but you didn’t participate in that part of the discussion.

Before further commenting, please read the
Rules in Main UI section of the docs: https://next.openhab.org/addons/automation/jsscripting/#rules-in-main-ui
Then you’ll see what’s documented and what’s not.