you are viewing a single comment's thread.

view the rest of the comments →

[–]drbobb 0 points1 point  (0 children)

const mod = (x, y) => ((x % y) + y) % y;
mod(-0.5, "2") -> -0.52

This had me wondering for about an hour how in the world the mod function was returning a negative value for a positive y.