Finding a Remainder in JavaScript?

Tell us what’s happening:

I just wonder whether there are variety of answers of this chapter or not.
The instructions ask us ‘Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.’ which means the remainder is 2.

So, it would be 2 % 3, 2 % 4, 2 % 5, 2 % 6, 2 % 7, 2 % 8, 2 % 9, 2 % 10, 2 % 11 …
or 20 % 18, 21 % 19… also leave the remainder which is 2.

So, there mustn’t be only one answer in this chapter, so you guys don’t have to be confused with many different answers.

Please let me know if my guess is wrong.

Thanks. Let’s coding guys.

``````// Only change code below this line

var remainder = 2 % 15;

``````

Your Browser User Agent is: `Mozilla/5.0 (Windows NT 6.1; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; InfoPath.2; .NET4.0C; .NET4.0E; MARKANYEPS#25115; rv:11.0) like Gecko`.

Ha! Ha! You’re right, of course, it works too. But that’s really a limitation of the tests used. The instruction is meant to be taken literally: Use the % operator with 11 and 3.

Of course you can get the same result with a different operation but it’s not what you’re supposed to do. It’s a bit as if you were being asked to use the + operator on 4 and 5. Sure you could write `var result = 6 + 3;`, the answer would be 9 too but that’s not what is being asked.

That said it doesn’t matter. What matters is that you know there is a % operator and you know how to use it correctly. It will come in handy in the future and you will be the one deciding what numbers to apply it on.