Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created May 4, 2020 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/4396d33625db6998a4417c6c52ff997a to your computer and use it in GitHub Desktop.
Save codecademydev/4396d33625db6998a4417c6c52ff997a to your computer and use it in GitHub Desktop.
Codecademy export
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