How to create a hidden (javascript) variable?

Like, one that you can access with set variable blocks but doesn't appear in the variables palette. maybe a separate block for reporting hidden variables;
[scratchblocks]
(hidden variable [ v]::variables
[/scratchblocks]

window.<variable name> = '<variable value>';
To get the value:
window.<variable name>

And to call it?
Are you sure it's

And not
window.<variable name> = '<variable value>'

https://snap.berkeley.edu/snap/snap.html#present:Username=sathvikrias&ProjectName=hidden%20vars%20(%40silver%20star)

Better versions:
image
image

can you share a project with that code?

it's not that hard to copy.

yes, but I have a break from school right now and it will end soon :slightly_frowning_face:


@silver_star

that doesn't work, how do you make a variable?

set variable = make variable

How is this topic a "help with Snap!" topic. This is exactly the kind of question that scares off our target audience. Again, if I see more of these topics I will take out the JS function block. And I will propose to ban those who can't stop obsessing about such "secrets".