var a1 = 0, a2 = 1, a3 = 2; for (var i in window) if (/^a\d+$/.test(i.toString())) window[i] = 100500;