What is the wrong in this code?

please i need help with this
(we have 4 nitrogen bases in our DNA and each 3 will form codon in mRNA so there are 64 possible codons)
i made a function for this but there is something wrong and i need help.
here is the link:

length is spelled as lenght is the first part I noticed. I haven’t checked the logic yet.

1 Like

It’s hard to tell with the amount of nesting from my phone, but you can’t return twice from the same function. The second one can’t be reached.

Also, anytime you are nesting 3 for loops you should rethink your approach. The efficiency of this when you deal with larger data sets (like a human genome) will not be acceptable.


A triple nested loop can be defined in Big O notation as O(n³). Read more about that here: Beginner’s Guide to Big O notation

1 Like

how i can return the second function?

You only have one function.

1 Like

you don’t need 2 returns because you “totalNumbersOfCodons” is global then you just need to return the array and after the function return make a totalNumbersOfCodons = codons.length or let totalNumber = possibleCodons(bases).length; …remenber the function is a piece of code who retorn just one thing and do something stuff.

1 Like