Mysterious Organism

I am working on Mystery Organism and i am stuck with #7. we are making a factory function that creates an object with one of the properties is named specimenNum. i need specimenNum to increase by one for each object created and im having trouble doing that. This is my code so far.

// Returns a random DNA base
const returnRandBase = () => {
  const dnaBases = ['A', 'T', 'C', 'G']
  return dnaBases[Math.floor(Math.random() * 4)] 
}

// Returns a random single stand of DNA containing 15 bases
const mockUpStrand = () => {
  const newStrand = []
  for (let i = 0; i < 15; i++) {
    newStrand.push(returnRandBase())
  }
  return newStrand
};

const pAequorFactory = (num, seq) => {
  return {
    specimenNum: num++,
    dna: seq,
    mutate(){
      let idx = Math.floor(Math.random() * 15);
      let x = this.dna[idx];
      let y = '';
      do {
        y = returnRandBase();
      } while (x === y);
      if (x !== y) {
        this.dna.splice(idx, 1, y);
      }
      return this.dna;
    },
    compareDNA(obj) {
      let match = 0
      for (x = 0; x < this.dna.length; x++) {
        if (this.dna[x] === obj[x]) {
          match++;
        }
      }
      let percenti = match/obj.length * 100
      let percent = (match/obj.length * 100).toFixed(2);
      return `The two DNA strands have ${percent}% DNA in common.`
    },
    willLikelySurvive(){
      let match = 0
      for (x = 0; x < this.dna.length; x++) {
        if (this.dna[x] === 'C' || this.dna[x] === 'G') {
          match++;
        } 
      }
      let percent = match/this.dna.length * 100;
      if (percent < 60) {
        return false;
      }
      return true;
    }
  }
};


let arr = [];
let count = 0
let match = 0;
do {
  let test10 = pAequorFactory(1, mockUpStrand());
  test10 = test10.willLikelySurvive();
  console.log(test10);
  count++;
  if (test10 === true) {
    match++;
  }
} while (match < 30);
console.log(match)
console.log(count)

never mind i figured it out,
my finished code is:

// Returns a random DNA base
const returnRandBase = () => {
  const dnaBases = ['A', 'T', 'C', 'G']
  return dnaBases[Math.floor(Math.random() * 4)] 
}

// Returns a random single stand of DNA containing 15 bases
const mockUpStrand = () => {
  const newStrand = []
  for (let i = 0; i < 15; i++) {
    newStrand.push(returnRandBase())
  }
  return newStrand
};

const pAequorFactory = (num, seq) => {
  return {
    specimenNum: num,
    DNA: seq,
    mutate(){
      let idx = Math.floor(Math.random() * 15);
      let x = this.DNA[idx];
      let y = '';
      do {
        y = returnRandBase();
      } while (x === y);
      if (x !== y) {
        this.DNA.splice(idx, 1, y);
      }
      return this.DNA;
    },
    compareDNA(obj) {
      let match = 0
      for (x = 0; x < this.DNA.length; x++) {
        if (this.dna[x] === obj[x]) {
          match++;
        }
      }
      let percenti = match/obj.length * 100
      let percent = (match/obj.length * 100).toFixed(2);
      return `The two DNA strands have ${percent}% DNA in common.`
    },
    willLikelySurvive(){
      let match = 0
      for (x = 0; x < this.DNA.length; x++) {
        if (this.DNA[x] === 'C' || this.DNA[x] === 'G') {
          match++;
        } 
      }
      let percent = match/this.DNA.length * 100;
      if (percent < 60) {
        return false;
      }
      return true;
    }
  }
};


let arr = [];
let count = 0
let match = 0;
let counter = 1
let counters = 0
do {
  let test10 = pAequorFactory(counter, mockUpStrand());
  test11 = test10.willLikelySurvive();
  counter++
  if (test11) {
    match++;
    counters++;
    arr.push({Test: test10.specimenNum, Completed: counters, DNA: test10.DNA})
  }
} while (match < 30);
console.log(arr);

thanks for posting your code it really helped me understand what to do in the project. I tried to only look at it for reference rather than a cheat.