What is the result of this? ( 10+22)%3. HINT: Read about modulo operation.
Your Answer
check_box 3
Correct Answer
check_box 2
When I looked into it I think the answer should be 32, why am I wrong or is the question wrong?
What is the result of this? ( 10+22)%3. HINT: Read about modulo operation.
Your Answer
check_box 3
Correct Answer
check_box 2
When I looked into it I think the answer should be 32, why am I wrong or is the question wrong?
Hey @Jargo, hope you are ok.
The question is correct, the result of the operation is 2.
Maybe you miss understood how the modulo operator works in JS.
Here are some resources about the modulo operator:
If you have any more questions, please let us know so we can help you!
Carlos Z.
Thanks for the clarification @thecil , I can see when I input it as you have I do indeed get the result of 2.
What I was doing was console.log (10+22)%3 which prints the result 32. Why the difference though?
Thanks again for your help.
The problem here is the way you are using the console.log()
function, the entire operation should be sent has an argument (10+22)%3
, so it should be:
console.log( (10+22)%3 )
.
The problem is that console.log()
will only print the values inside his ().
If you have any more questions, please let us know so we can help you!
Carlos Z.