Tell us what’s happening:
Your code so far
// Only change code below this line
var remainder;
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript
1 Like
ilenia
2
if you don’t tell us what’s happening we can’t help you
Research is always a good thing. The devdocs web site is a very important one to bookmark, as there’s a WEALTH of great information there.
In this particular case, you’re looking for an arithmetic operator. Specifically, one for the remainder. Take a look on this page: https://devdocs.io/javascript/operators/arithmetic_operators and keep an eyeball peeled for “remainder”.
Hey! Please provide us more information on what happening,
so we could try to help you!
i don’t know how to do it
You should set 11 % 3
to var remainder;
like this:
var remainder = 11 % 3;
So it give you the reminder. In this case, the reminder of 11 is 2.
The reminder operator give the reminder of the division of two numbers.
And also, with the reminder operator, you can check if a number is even or odd, by checking a number by % 2
.
- If the reminder is 0, the number is even,
- If the reminder is 1, the number is odd.
1 Like