Print All Prime Numbers Between 1 & 100

Solution


function primeNumbers() {
    for (var i=0; i<=100; i++) {
    var prime = true;
    for (var j=2; j<=i; j++) {
        if (i%j===0 && j!==i) {
            prime = false;
        }
    }
    if (prime) {
        console.log(i)
    }
   }
}