This question is based on running the following code in the Chrome console

//function for returning true for Prime, false for not Prime

function isPrime(num){

if(num <=1) return ‘not a valid number’;

```
if (num === 2) return 'prime';
for(var i = 3; i < num; i+=2){
if(num%i === 0)return false
} return true
```

};

//function for creating an array of the prime numbers up to number n and returning the array length

function primeList(n){

var arr = [2];

for (var j = 3; j < n; j+=2){

if(isPrime(j)){

arr.push(j);

}

}

return arr.length;

}

When I run:

primeList(150) = 35

primeList(15000) = 1754

primeList(150000) = no result returned, no time out, no error

I have checked how many integers I can push into an empty array and it is far bigger than this. (1000000000)

Can you see any reason for this behaviour. I’m simply curious to why.

TIA