Why are my curly braces and square brackets displaying on the console?

I’m not sure if this is normal! And if not, how do I fix it?

Here’s my code:

// 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 = (specimenNum, dna) => {
    return {
      specimenNum : specimenNum,
      dna : dna,
    }
}

const organism = pAequorFactory(1, mockUpStrand());
console.log(organism);

And here is what it returns:

{ specimenNum: 1,
dna: [ ‘G’, ‘G’, ‘T’, ‘G’, ‘A’, ‘C’, ‘A’, ‘G’, ‘C’, ‘T’, ‘C’, ‘G’, ‘C’, ‘G’, ‘A’ ] }

Yes, that’s normal behaviour for objects and arrays when printing them.

1 Like