Error in Reading Assignment Quiz for Variables

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?

1 Like

Hey @Jargo, hope you are ok.

The question is correct, the result of the operation is 2.
image

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! :slight_smile:

Carlos Z.

1 Like

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?

image
Thanks again for your help.

1 Like

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! :slight_smile:

Carlos Z.

2 Likes