Dom67
(dpmarando@protonmail.com)
September 14, 2020, 8:30pm
1
There are 5 parts to this Math Test 1, and I am not sure if I understood the fifth part and answered it correctly. I am having a really difficult time with it.
Part 5 states, " Finally, write a calculation that checks whether finalResult
is an even number. Store the result in a variable called evenOddResult.
" Here is the link: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Test_your_skills:_Math
I have even read answers to this same problem from others’ submissions at Mozilla Discourse and I have not understood the answer.
Here is a link to my code answers on JS Fiddle: https://jsfiddle.net/Dom67/mupzasog/5/
Thank you for your help.
Hello @Dom67
to test if a number is even you need to check if it dividable by 2 or not that mean thenumber % 2 ===0 as the module caculate the remaming of the the division of number /2
hope that help and have a nice day
Dom67
(dpmarando@protonmail.com)
September 15, 2020, 4:18pm
3
Hello,
I am not sure if I understood your answer, but here is what I have done. Please tell me if this is correct: evenOddResult = 48 % 2;
You can view my updated file on JS Fiddle here: https://jsfiddle.net/Dom67/mupzasog/7/
Dom67
(dpmarando@protonmail.com)
September 15, 2020, 4:41pm
4
In looking at this again, and reading the “Part 5” instruction over again, I have adjusted my coding as follows: evenOddResult = finalResult % 2;
Here is the updated file on JS Fiddle: https://jsfiddle.net/Dom67/mupzasog/9/
your final code is fine but you can use this instead if you like
evenOddResult = finalResult % 2;
so it test despite the value of the finalResult
well done and have a nice day
1 Like
you welcome and thanks and you too
1 Like