Finding a Remainder in JavaScript 12

Tell us what’s happening:
Describe your issue in detail here.

These code doesn’t work, what can be the problem?


const remainder = 2;
remainder = 11 % 3;

Your browser information:

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

Challenge: Finding a Remainder in JavaScript

Link to the challenge:

You are using a const value which cannot be changed.
That is why you are getting an error

There are two ways of solving this.

One is by using your code and changing the const into a let.

The second is to find the remainder by using the remainder operator in the line where you initialise the remainder variable.

2 Likes

Since you were given a const variable, I would suggest you use the second method.

i tried these solotion and it worked “const remainder = 11 % 3;” :pray:t6:

1 Like

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