Mysterious organism

im working on the mysterious organism project and im having trouble figuring out why when i run the .mutate method it just returns [Funtion: mutate]. Note some syntax errors by be located at the end since I kept working on the project broken code and all

this is my code:
const pAequorFactory = (specimenNum , dna) => {
speciemenNum: specimenNum ,
dna: dna,
mutate() {
const mutBase = Math.floor(Math.random() * this.dna.length)
while (this.dna[mutBase] === returnRandBase());{
return this.dna(mutBase);
return this.dna;

I tested it by running :
let test = pAequorFactory(1, mockUpStrand());
let testdna = test.dna;
let testmutate = test.mutate;

and the console returns the following :
[ β€˜T’, β€˜C’, β€˜G’, β€˜C’, β€˜G’, β€˜T’, β€˜C’, β€˜G’, β€˜T’, β€˜T’, β€˜A’, β€˜C’, β€˜G’, β€˜G’, β€˜T’ ]
[Function: mutate]

i looked at the given solution code and noticed that they have the new base in .mutate stored as a new variable where i just try to run the code in the while loop since that seems like an extra step or is it necessary to get the code to properly execute?

there is an extra semicolon after the while condition, it will break your while block so, remove it. also, is this the full code? because I’m seeing duplicate return statements under each other and that’s strange because of course, the second one will never be executed.

also please in Codecademy forums you can reformate the code so it can be more readable. there is a tool for that you can find it next to the upload tool. or just select the code and press ctrl + shift + c as a shortcut. you can edit your question and try it.

1 Like


I am also having a similar problem with the mutate function. Please see code below and then the output.

// 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++) {



return this.dna


const pAequorFactory = (num, arrayDnaBase) => {

return {

specimenNum: num,

dna: arrayDnaBase,

mutate() {

let randomBase = returnRandBase();

let randomIndex = Math.floor(Math.random() * 15);

while (this.dna[randomIndex] !== randomBase) {

this.dna[randomIndex] = returnRandBase();

return this.dna





const pAequor = [ β€˜T’, β€˜C’, β€˜G’, β€˜T’, β€˜A’, β€˜T’, β€˜A’, β€˜C’, β€˜T’, β€˜C’, β€˜C’, β€˜C’, β€˜G’, β€˜C’, β€˜G’ ];


This then returns the following output:
{ specimenNum: 1,
dna: [ β€˜T’, β€˜C’, β€˜G’, β€˜T’, β€˜A’, β€˜T’, β€˜A’, β€˜C’, β€˜T’, β€˜C’, β€˜C’, β€˜C’, β€˜G’, β€˜C’, β€˜G’ ],
mutate: [Function: mutate] }

Any ideas?