If you declare a variable outside of a function, it becomes global.
If you have problems, you can attach the variable to the window.
1 2 3 4 5 6 |
function dog() { window.myvalue = "Yay it works"; } |
and check it by
1 2 3 |
alert(window.myValue); |