Tell us what’s happening:
Hey there
I’m going through basic JS and a question has come up that seems odd. N E ideas?
Set remainder
equal to the remainder of 11
divided by 3
using the remainder ( %
) operator.
Your code so far
My code is:
11 % 3 = 2;
remainder = 2;```
// Only change code below this line
```var remainder;
11 % 3 = 2;
remainder = 2;
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript
I see why you are confuse: You tried to copy the example. Which is incorect because this isn’t code.
The example and usage are made to explain how remainder works but aren’t line of code.
You can’t write :
11 % 3 = 2 in your code. This is incorrect because this means you are giving 11%3 a value of 2 but 11%3 is not a variable
also you can write remainder = 2; but this do not accomplish what you want here.
writing: remainder = 2; set the value of remainder to 2. (You have a variable named ‘remainder’ and you put 2 inside)
What is asked here is to put a value of 2 inside the remainder but by using a mathematical operation (here with the remainder (%) operator).
There should be only one line in your code.
Hope it’s clear enough
. Try to think about it and come up with your answer.
If you still don’t understand check again how to set a value to a variable.
1 Like
(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)