I've got a small problem. I want to read a var defined inside tag in DOM.
<script id="foo">
var x = 1
</script>
I can access it via:
var script = document.querySelector("#foo");
But then what? Of course
var x_value = script.x
or
var x_value = script.outerHTML.x
doesn't work. So how can I get x's value then?
Thanks for your help!