+ 7
var myVariable = 26 % 6; document.write(myVariable); .... why it's output shows "2"??
2 ответов
+ 16
26 / 6 = 24 with remainder 2.
26 % 6 returns the remainder of 26 / 6, which is 2.
+ 4
It's output is 2 because,
26 divided by 6 = 4 with remainder 2. '%' sign stands for modulus, which means remainder. So, 26 divided by 6 will leave 2 as remainder, and 2 will be the output. Another example:
17 % 3 = 2