<script> var variable1, variable2, variable3; for(var i = 1; i <= 3; i++) window['variable' + i] = 'someValue'; alert([variable1, variable2, variable3]); </script>