Answer the question
In order to leave comments, you need to log in
Remainder after dividing by 1?
And so in js there is an operator % remainder of division, it is convenient for them to check the evenness of a number ( n%2 == 0 ) and ATTENTION is it an integer of the type if the number is an integer then num%1 will be zero if the fraction is 0+fraction but I can’t understand because if you divide the number by 1, then there will be a number and not 0, that is, the remainder will always be the number that we divided by 1.
Maybe I don’t know math well, or is it fun js explain please.
Sorry for the letter too lazy to put the Russian layout.
Answer the question
In order to leave comments, you need to log in
% is the operation of taking the remainder of the division, not the quotient. The remainder of dividing any integer by 1 is 0, since any integer can be represented as a sum of units, and 1 is divisible by 1 without a remainder.
Example:
3% 1 = 3 (mod 1) = 1 + 1 + 1 (mod 1) = 0 + 0 + 0 = 0
if the number is an integer then num%1 will be zero
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question