Basic JavaScript - Finding a Remainder in JavaScript

Tell us what’s happening:

Set remainder equal to the remainder of 11 divided by 3 using the remainder (% ) operator.
–I guess the biggest part I am struggling with is how to use the % effectively, I have tried many different layouts, different combinations. Any pointers would be appreciated.

Your code so far

const remainder = 2;
11 % 3;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36

Challenge Information:

Basic JavaScript - Finding a Remainder in JavaScript

Hi!
Your const remainder should have the value of 11 modules 3 like you did here:

Why does it have the value of two?

Tests

  • Passed:The variable remainder should be initialized

  • Passed:The value of remainder should be 2

  • Failed:You should use the % operator

That test is saying that remainder should have 2 as its value after your use the % operator to set the value of remainder to what the remainder of 11 / 3 is.

1 Like

The equation 11/ 3 = 3 remainder of 2
so I guess there is something in there that I am not understanding.

You are setting the remainder = 2 instead of letting JavaScript compute what the remainder should be with the % operator.

Your code should be exactly 1 line. Combine your two lines.

thank you so much! now that makes sense! I really appreciate the help!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.