-
-
Save codecademydev/4396d33625db6998a4417c6c52ff997a to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const whatRelation = percentSharedDNA => { | |
if (percentSharedDNA === 100) { | |
return 'You are likely identical twins.' | |
} | |
if (percentSharedDNA > 34) { | |
return 'You are likely parent and child or full siblings.' | |
} | |
if (percentSharedDNA > 13) { | |
return 'You are likely grandparent and grandchild, aunt/uncle and niece/nephew, or half siblings.' | |
} | |
if (percentSharedDNA > 5) { | |
return 'You are likely 1st cousins.' | |
} | |
if (percentSharedDNA > 2) { | |
return 'You are likely 2nd cousins.' | |
} | |
if (percentSharedDNA > 0) { | |
return 'You are likely 3rd cousins' | |
} | |
return 'You are likely not related.' | |
} | |
console.log(whatRelation(34)) | |
// Should print 'You are likely grandparent and grandchild, aunt/uncle and niece/nephew, or half siblings.' | |
console.log(whatRelation(3)) | |
// Should print 'You are likely 2nd cousins.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment