Modulo Operator %%

Matthew Morgan mmm211 at zips.uakron.edu
Mon Aug 12 20:00:09 UTC 2019


JS needs a modulo operator. It currently has the remainder operator `%`
which works in most cases except for negative values. I believe the the
`%%` would work great and be easy to remember.

let x = (-13) %% 64;
is equivalent to
let x = ((-13 % 64) + 64) % 64;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190812/ec877f98/attachment.html>


More information about the es-discuss mailing list