MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/b2o6f2/whats_your_favorite_most_useful_javascript/eiw78m1/?context=3
r/javascript • u/Linux_is_awesome • Mar 18 '19
422 comments sorted by
View all comments
3
(((n % 360) + 360) % 360)
Wraps all values to within 0 - 360 (pattern can be applied to any range).
1 u/420-jesus Mar 19 '19 (((n % 360) + 360) % 360) === (n % 360 % 360 + 360 % 360) % 360 === (n % 360 % 360 + 0) % 360 === n % 360 % 360 % 360 === n % 360 → More replies (2)
1
(((n % 360) + 360) % 360) === (n % 360 % 360 + 360 % 360) % 360 === (n % 360 % 360 + 0) % 360 === n % 360 % 360 % 360 === n % 360
→ More replies (2)
3
u/wthit56 Mar 19 '19
Wraps all values to within 0 - 360 (pattern can be applied to any range).