/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> var MyVariable = 'global'; function x() { var MyVariable = 'local'; alert('x: ' + MyVariable); } function y() { alert('y: ' + MyVariable); } x(); y(); </script>
Comments
