Question: I wrote this function that generates prime numbers for a given range of numbers, I think it's simple and clear that must give the expected result, though, there are numbers that are excluded from the result:

```js
function numberator(from, to) {
    numbers = [];
    for (x = from; x <= to; x++) {
        numbers.push(x);
    }
    return numbers;
}

function primeNumbers(array) {
    for (i = 0; i < array.length; i++) {
        for (j = 2; j < array[i]; j++) {
            if (array[i] % j == 0) {
                array.splice(i, 1);
            }
        }
    }
    return array;
}

console.log(primeNumbers(numberator(1,100)));
```

The result contains: 27, 35 and 95 (also 1, that I may handle later.)

I tried to figure out why but I couldn't.

Answer: 
Just want to share a simple and very easy to understand Javascript code to generate small prime numbers: <https://github.com/HMaxF/generate-small-prime-number>
Take it more simple : 

```
const isPrime = (n =>
        n>1 && 
        Array.from({length: Math.floor(Math.sqrt(n))-1},(e,i) => i+2)
             .every(m => n%m)
);

const generateRange = (from, to) => Array.from({length: to-from + 1}, (v, k) => k+from);

```

then 

```
generateRange(1, 100).filter(isPrime); // DONE!

```

```js
//---- Utilities 
const isPrime = (n =>
        n>1 && 
        Array.from({length: Math.floor(Math.sqrt(n))-1},(e,i) => i+2)
             .every(m => n%m)
);

 const generateRange = (from, to) => Array.from({length: to-from + 1}, (v, k) => k+from);

//---------Apply ---
const from = 1;
const to = 100; 

 console.log (
    `Prime numbers from ${from} to ${to} are : `,
    generateRange(from, to).filter(isPrime)
  )
```