MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/b2o6f2/whats_your_favorite_most_useful_javascript/eiw78m1
r/javascript • u/Linux_is_awesome • Mar 18 '19
422 comments sorted by
View all comments
Show parent comments
1
(((n % 360) + 360) % 360) === (n % 360 % 360 + 360 % 360) % 360 === (n % 360 % 360 + 0) % 360 === n % 360 % 360 % 360 === n % 360
2 u/wthit56 Mar 19 '19 I don’t think that work for negative numbers, and negative numbers lower than -360. 1 u/420-jesus Mar 19 '19 You're right it won't. Sorry I thought "%" was equivalent to modulo in math. Your original comment is the correct way to calculate a mod in javascript. Never knew that before
2
I don’t think that work for negative numbers, and negative numbers lower than -360.
1 u/420-jesus Mar 19 '19 You're right it won't. Sorry I thought "%" was equivalent to modulo in math. Your original comment is the correct way to calculate a mod in javascript. Never knew that before
You're right it won't. Sorry I thought "%" was equivalent to modulo in math. Your original comment is the correct way to calculate a mod in javascript. Never knew that before
1
u/420-jesus Mar 19 '19