ProjectEuler Problem #3
You have excessive, unnecessary comments.  You wrote your code clean enough that you don't need them.




for (x = 2; x &lt;= Math.sqrt(i); x++) {
  if (i % x == 0) {prime = false}
}



You are wasting your time here.  Once you know the value is not a prime, you do not need to continue looping.  This will reduce your time greatly:

for (x = 2; x &lt;= Math.sqrt(i); x++) {
  if (i % x == 0) {
    prime = false;
    break;
  }
}





if(prime){ array.push(i); factor(number/i, i); }



I'm not sure why you continue finding all the small factors when only the largest prime factors are needed.  In fact, if you are going to do it manually looping over each number, you should start high and work toward the smaller numbers.  A better way to do it, however, would be to use the Sieve of Eratosthenes, as mentioned in the comments on your post.