Why 1%2 results in 1 in JavaScript while when I divide 1 by 2 normally you get 0 as the reminder?

So I know this question seems kind of stupid, but recently I was going through some JS questions and I happen to do 1 % 2 in the browser console and I got 1, while when I did 1 divided by 2 on a paper I got the reminder 0. I am well aware of the concept that the value returned is the reminder, but why is it different in JavaScript and when I do on a paper ? Is there any underlying concept of JS that I’m not aware about ? Thanks in advance.

7 thoughts on “Why 1%2 results in 1 in JavaScript while when I divide 1 by 2 normally you get 0 as the reminder?”

Leave a Comment