Keramet,
<script>
var arr = [];
for (var i=2; i<100; i++) {
if(i%2 == 0 || i % 3 == 0) continue;
arr.push(i)
};
document.write(arr+"<br>")
for (var i = 2, arr = []; i < 99; i++) arr.push(i);
for (var i=arr.length-1, a; a = arr[i]; i--) {if(a%2 == 0 || a % 3 == 0) arr.splice(i,1)}
document.write(arr)
</script>