assign variable as global js code example
Example: create global variable inside function JavaScript
<script>
function foo() {
window.yourGlobalVariable = ...;
}
</script>
<script>
function foo() {
window.yourGlobalVariable = ...;
}
</script>