I don’t understand why && operator isn’t necessary when you want to fulfill the conditions below.
Here’s how it’s supposed to calculate the relationship:
100 should return 'You are likely identical twins.'
35-99 should return 'You are likely parent and child or full siblings.'
14-34 should return 'You are likely grandparent and grandchild, aunt/uncle and niece/nephew, or half siblings.'
6-13 should return 'You are likely 1st cousins.'
3-5 should return 'You are likely 2nd cousins.'
1-2 should return 'You are likely 3rd cousins.'
0 should return 'You are likely not related.'
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.'
}
For me, for instance,
if (percentSharedDNA > 34 && percentSharedDNA < 100) {
return 'You are likely parent and child or full siblings.'
seems to work well.