+ 2

Please can anyone explain to me why the modulus of 2 is 2?

var str =""; str += 2 % 3; Console.log(str); Result= 2

4th Jun 2019, 1:37 AM
Okere Chinedu
Okere Chinedu - avatar
3 Answers
+ 2
2 == 3*0 + 2 // remainder is 2
4th Jun 2019, 1:42 AM
Diego
Diego - avatar
+ 2
2%3=3*0+2!
4th Jun 2019, 10:23 AM
CodeFu
CodeFu - avatar
+ 1
Because if you divide 2 by 3, the remainder will be 2.
4th Jun 2019, 2:43 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar