Mysterious Organism - Step 9 Part 2 - Two Most Related DNA Instances

Hello,

I am stuck on the very last part of the Mysterious Organism project. ( ** Use the .compareDNA() to find the two most related instances of pAequor .*)

Right now when I use my method at the bottom to return the top two sequences, it always just returns one with a value of 7. Any idea where this went wrong? I’ve been testing the code along the way so I think the problem lies in the topTwo function.

Link to Project:
https://www.codecademy.com/practice/projects/mysterious-organism

// 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
}

// Returns percentage of a number
const percentage = (num,outOf) => {
  return (num/outOf)*100;
}

// Factory Function to create DNA objects
const pAequorFactory = (number, dnaArray) => {
  return {
    specimenNum: number,
    dna: dnaArray,
    mutate () {
      //change the DNA according to the directions
      const random = Math.floor(Math.random() * 15);
            const dnaBases = ['A', 'T', 'C', 'G'] 
      const original = this.dna[random];
      let mutatedBase = dnaBases[Math.floor(Math.random() * 4)];    
      while (original === mutatedBase) {
        mutatedBase = dnaBases[Math.floor(Math.random() * 4)]
      }
      this.dna[random] = mutatedBase;
      return this.dna;
    },
    compareDNA (otherDNA) {
      //finding out what % of this DNA sequence has with another DNA sequence
      let counterDNA = 0;
      for (let i = 0; i < 15; i++) {
        if(this.dna[i] === otherDNA.dna[i]) {
          counterDNA ++;
        }
      }
      return `specimen ${this.specimenNum} and specimen ${otherDNA.specimenNum} have ${Math.round(percentage(counterDNA, 15))}% DNA in common`
      
    },
    willLikelySurvive () {
      //is 60% of DNA C or g? then return true
      let gCounter = 0;
      let cCounter = 0;
      for(let i = 0; i < 15; i++) {
        if (this.dna[i] === 'G') {
          gCounter++          
        } else if (this.dna[i] === 'C') {
          cCounter++
        }
      }
      if(gCounter + cCounter >= 9) {
        return true;
      } else {
        return false;
      }
    },
    complementStrand () {
      //making a complementary strand of DNA to the current one
      for(let i = 0; i < 15; i++) {
        switch (this.dna[i]) {
          case 'A':
            this.dna[i] = 'T';
            break;
          case 'T':
            this.dna[i] = 'A';
            break;
          case 'C':
            this.dna[i] = 'G';
            break;
          case 'G':
            this.dna[i] = 'C';
            break;
        }
      }
      return this.dna;
    }

  }

}


let listOfObjects = [];
let comparedStrands = [];

//Creating 30 strands of DNA that will survive and putting them into an array (listOfObjects)
const createStrands = () => {
let i = 0;
while (listOfObjects.length < 30) {
    let mock = pAequorFactory(i, mockUpStrand());
    if(mock.willLikelySurvive = true) {
    listOfObjects.push(mock);
    }
    i++;
  }
}

//Using compareDNA method to put all possible comparisons between two DNA sequences in an array (comparedStrands)
const listOfComparisons = () => {
for(let i = 0; i < 30; i++) {
  for(let j = 0; j < 30; j++) {
    if(i != j) {
    comparedStrands.push(listOfObjects[i].compareDNA(listOfObjects[j]))
    }
  }
}
}

// Finding the two most related instances of pAequor
const topTwo = () => {
  let topDawg = 0;
  let finalReturn;
  for(let i = 0; i < comparedStrands.length; i++) {
    let current = comparedStrands[i].slice(comparedStrands[i].indexOf('have') + 5, comparedStrands[i].indexOf('%'));

    if(i === 0) {
      topDawg = current;
      finalReturn = comparedStrands[i];
    } else if(topDawg <= current ) {
      topDawg = current;
      finalReturn = comparedStrands[i];
    }  
  }
  return finalReturn;
}

createStrands();
listOfComparisons();

console.log(topTwo());