Variables are accessible through window.huggingface.variables in JavaScript! Checkout the source code for index.html in the "Files" tab.
Also don't forget to check the Static Spaces documentation.