# freeCodeCamp Challenge Guide: Finding a Remainder in JavaScript

freeCodeCamp Challenge Guide: Finding a Remainder in JavaScript
0

#1

The remainder operator `%` gives the remainder of the division of two numbers.

## Example

``````5 % 2 = 1 because
Math.floor(5 / 2) = 2 (Quotient)
2 * 2 = 4
5 - 4 = 1 (Remainder)
``````

## Usage

In mathematics, a number can be checked even or odd by checking the remainder of the division of the number by 2.

``````17 % 2 = 1 (17 is Odd)
48 % 2 = 0 (48 is Even)
``````

Instructions
Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.
Note Do not confuse it with modulus `%` does not work well with negative numbers.

“just follow the instructions as directed”

ANSWER: // Only change code below this line

var remainder= 11 % 3;

#2

I have been struggling to get this formatted correctly. Any help would be appreciated. I put:

(11 % 3 = 2);

for my answer and it has a yellow caution triangle and says “Bad Assignment” pointing to the equals sign.

#3

var remainder = 2 % 11;

#4

The remainder operator % gives the remainder of the division of two numbers.
Example
Usage
Note

Instructions
Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.

1. The variable remainder should be initialized
`var remainder`

2)The value of remainder should be 2
`var remainder = 2;`

1. You should use the % operator
var remainder = 2%11;

`

#5

Can anyone clarify what they’re saying here?

17 % 2 = 1 (17 is Odd)
48 % 2 = 0 (48 is Even)

“Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.”

var remainder = 2%11;

Where did 11 / 3 go?

#6

The above was an example. It is pretty easy but everyone has to be verbose when explaining shit here.

For 11 % 3 all you do is divide 11/3, which =3 with a remainder of 2.

can double check by 3x3=9
11-9=2(same as the remainder)

#7

I have no idea what the final part of this task was on about.

I understand the following
`17 % 2 = 1 (17 is Odd)`
`48 % 2 = 0 (48 is Even)`

In the final part, the correct answer is `var remainder = 2 % 11;`, but I have no idea what this has to do with `11 / 3`.

#8

I entered “var remainder = 11 % 3;”, which the system accepted as correct. However, looking here I see var remainder = 2 % 11; is supposed to be the correct answer. Can anyone please clarify whether 11 % 3 really is the correct syntax, and if not, why not? TIA.

#9

I think it’s this

``var remainder = 11 % 3;``

#10

Some info about the operator https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder_()

I think free code camp accepts the answer because the result of `2 % 11` is coincidentally the same `11 % 3`.

I got a bit confused about what they wanted, because they were talking about finding whether a number was odd or even earlier on in the tutorial.