Code Challenges: JS fundamentals – not getting checkmark though code works

Hi there,

I´m doing the code challenges and I keep not getting the green checkmark so that I can go to the next exercise. To be able to go forward, I have to ask for the solution every time. It is quite irritating, since I get my code to work.

Is this due to a standard CodeCademy solution not matching exactly mine? Or is this some kind of bug?

Hi,

I wouldn’t be able to give you answer unless I see an example so that we can rule out if its a bug or not.

If you could give more information or bring up the issue as you are experiencing it maybe we can rule it out together!

Thanks

Ok, thanks for your quick reply. I’ll see what I can do!

EDIT: this one post in the thread Can I find the current date using JS? seems to be related, just taking a note on it.

1 Like

Ok, so here´s the exercise: https://www.codecademy.com/paths/web-development/tracks/getting-started-with-javascript/modules/code-challenge-javascript-fundamentals/lessons/javascript-fundamentals-code-challenge/exercises/fix-the-broken-code-ii

Here´s my code, which is working as expected:

const whatRelation = percentSharedDNA => {
    if (percentSharedDNA === 100) {
        return 'You are likely identical twins.'
    }
    if (percentSharedDNA > 34 && percentSharedDNA < 100) {
        return 'You are likely parent and child or full siblings.'
    }
    if (percentSharedDNA > 13 && percentSharedDNA < 35) {
        return 'You are likely grandparent and grandchild, aunt/uncle and neice/nephew, or half siblings.'
    }
    if (percentSharedDNA > 5 && percentSharedDNA < 14) {
        return 'You are likely 1st cousins.'
    }
    if (percentSharedDNA > 2 && percentSharedDNA < 6) {
        return 'You are likely 2nd cousins.'
    }
    if (percentSharedDNA >= 1) {
        return 'You are likely 3rd cousins.'
    }
    if (percentSharedDNA === 0) {
        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.'

And still, the red “x” mark doesn´t dissapear, after I´ve run my previous code, which had some mistakes.

04

niece spelling is incorrect.

I have noted that the instructions has the incorrect spelling which I will report.