Count

in #ita2 days ago

export function nucleotideCounts(lett:string) {

const res: Record<string, number> = { A: 0, C: 0, G: 0, T: 0,}; // ricordarsi la virgola alla fine!

for(let i=0; i<lett.length; i++){

let char = lett[i]; // salvare il valore specifico che viene poi riaggiornato. 

if(lett[i] == 'A' || lett[i] == 'C' || lett[i] == 'G' || lett[i] == 'T') res[char]++;

else throw new Error('Invalid nucleotide in strand');

}

return res;

}

Sort:  

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below


BEERHey @drago18121996, here is a little bit of from @isnochys for you. Enjoy it!

BEER at dCity game to buy cards to rule the world.Did you know that <a href='https://dcity.io/cityyou can use

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below


BEERHey @drago18121996, here is a little bit of from @isnochys for you. Enjoy it!

Learn how to earn FREE BEER each day by staking your BEER.