I began programming recently. I am trying to implement a simple trial-division algorithm for finding all primes up to some number (it is much more primitive algorithm than the Sieve of Eratosthenes). Can you please find what's wrong with my code?#range function:range = function (a,b,c){    var range1=[]    for (i=a; i<b; i=i+c){        range1.push(i);    }    return range1;}#The algorithm:n=prompt(n);var numbers=range(2,n,1);var primes=[];for (number in numbers){ var sublist=range(2,number,1); console.log(sublist); for (x in sublist){  if (number%x ===0){   break;  } primes.push(number);  }}Thanks in advance!
Simple trial division in JavaScript
javascript