Sieve of Eratosthenes in JavaScript
Lets say that there is room for improvement. ;)

The prompt method returns a string, but you want a number, so you should parse the string:
var n = parseInt(prompt(&quot;Enter n: &quot;), 10);


Using indexOf on an array is slow. Instead of putting all the non-primes in a bucket and rummaging through it, you should use an array containing boolean values where the index is the number and the values tells you if it's a prime or not.
Accessing an array by index is an O(1) operation, while searching for a value in an array is an O(n) operaton. As n grows, this code will get slower and slower the longer you let it run.
As you are pushing a lot of duplicate non-primes in the array, an array of boolean values will actually use about 70% less memory eventhough the primes also takes up space in it.

This loop is pretty pointless:
for(var j = i ; i &lt;= j ; j++){

The condition will never be false. You should instead use the i * j &lt; n condition to break out of the loop:
for(var j = i; i * j &lt; n; j++){
  notPrime[i * j] = true;
}


Edit:
You are still using the array as a kind of collection. You should set all values to true at start, and then set all non-primes to false. This code (based on the algorithm here) is about five times faster:
var n = parseInt(prompt(&quot;Enter n: &quot;), 10);
var i, j;
var prime = new Array(n);
for (i = 2; i &lt; n ; i++) prime[i] = true;

for (i = 2; i * i &lt; n ; i++) {
  if (prime[i]) {
    for (j = 0; i * i + i * j &lt; n ; j++) {
      prime[i * i + i * j] = false;
    }
  }
}

var cnt = 0;
for (i = 2 ; i &lt; n ; i++) {
  if (prime[i]){
    console.log(i);
  }
}