Project 90: First N Primes

Project 90: The variable 'n' has been initialized.  There is also a working method called isItPrime available.

isItPrime(5) return true because 5 is prime.

isItPrime(15) returns false because 15 is not prime (5x3).

Task: Assign the array 'primes' to contain the first 'n' primes.

Example:  Suppose 'n' was randomly assigned to hold the value 8.  The array primes should hold the values shown below.

                  [2, 3, 5, 7, 11, 13, 17, 19]

Note: You can assume that 'primes' has already been created but is empty.  Remember the push method adds a value to the end of an array.

primes.push(5);

primes.push(7);

//x holds the values [5, 7]

**If your code works for 5 test cases, you can enter your e-mail address

Universal Computational Math Methods:

pow(5,2) returns 25.0

abs(-3.0) returns 3

sqrt(49.0) returns 7.0