For JavaScript executed in browser contexts, Keyboard Maestro provides (read-only) access to variable names and their values by initialising a document.kmvar object.
You can read its keys and values in the usual way, but you can't change KMVAR values through it.
If I have, for example a KM variable named 'scratchpad':
(For JS executed in a JavaScript for Automation context, there are both kmEngine.getvariable and kmEngine.setvariable methods, but these are not, of course, available in browsers)
For a panoptic view of the contents of document.kmvar, you could also, of course, write: