0
Java Script
What is % sign for ?
4 Réponses
+ 7
Yes: in other words, modulo is operator that return the reminder of the integer division ;)
+ 4
Integer division of A by B stand for 'how many integer times is B in A... Take 15 divided by 3, 3 fit 5 times, exactly so in integer division 15 / 3 equals 5, 0 left-over... Take now 16 / 3 equals 5 also, but 1 left-over, and so on... next number with remainder 0 is next multiple of 3 ( B ), so 18 / 3 equals 6 remainder 0...
% is operator for the left-over ( remainder ) part of the integer division ^^
Not sure to better explain, but I tried :P
+ 3
I think it is meant to be modular arithmetic sign.
Ex: 5 (mod 2) = 1 => a (mod b) = c -> a= b.k + c , k is a decimal as ...-1, 0, 1, 2,...
so,
var a = 5%2
now a variable is 1
0
I dont understnd and i wonder too😞