4. Print Prime Numbers between 1 to 100 in JavaScript

  

        /*
        A prime number is defined as a number which can be only divisible by 1 and that number itself.

        That number cannot be divisible by any other number.

        So if we try to divide that number by any other number between one and that number,
        we will get a remainder.

        According to the prime number definition number one ( 1 ) wont consider as a primary number.

        The smallest primer number is 2 .
        */

        var pr = 0;
        for (var p = 2; p <= 100; p++) {
        for (var i = 2; i <= 9; i++) {
        if (i != p) {
        if (p % i == 0) {
        pr = 0;
        break;
        } else {
        pr = 1;
        }
        }
        }
        if (pr == 1)
        console.log(p);
        }