I interned at NASA, working on statistical modeling and machine learning projects. Now I'm at Ferguson Enterprise, working on applying UX principles to internal tooling!
I see no problem with your solution. I like how you iteratively improved your solution.
Here is my solution.
varcomplements={A:'T',T:'A',C:'G',G:'C'}functionDNAStrand(dna){vardnaArray=[...dna];//turns string into arrary , where each character is an elementvarcomplementArray=dnaArray.map(x=>complements[x])//maps each character with it's complement and puts the result in an arrayreturncomplementArray.join("")//turn array into a string}
I see no problem with your solution. I like how you iteratively improved your solution.
Here is my solution.
or in one line
Nice and clean. Thanks Maurice!