Jump to content

%%%%%%%%%%


Drycodez
 Share

Recommended Posts

How does modulos operator works?
it's in the tutorials. have you read about operators yet?http://www.w3schools.com/js/js_operators.aspedit: it's the remainder from doing division (example from the tutorials)
x = 5 % 2; //x = 1

Edited by thescientist
Link to comment
Share on other sites

The modulus operator returns the remainder of a number divided by another.var x = 15%3;15 is divided equally by 3 (15/3 = 5) so the remainder is 0. x is equal to 0.var x = 15%4;15 is not divided equally by 4 (15/4 = 3.75). 4 only goes into 15 three times (4*3 = 12) with a remainder of 3 (15-12 = 3). x is equal to 3.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...