Drycodez Posted July 6, 2011 Share Posted July 6, 2011 How does modulos operator works? Link to comment Share on other sites More sharing options...
thescientist Posted July 6, 2011 Share Posted July 6, 2011 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 Link to comment Share on other sites More sharing options...
Drycodez Posted July 6, 2011 Author Share Posted July 6, 2011 it's in the tutorials. have you read about operators yet?http://www.w3schools.com/js/js_operators.asp yap, but i still dont understand the modulos part. Please, i need examples! Link to comment Share on other sites More sharing options...
ShadowMage Posted July 6, 2011 Share Posted July 6, 2011 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.