Mod and Remainder Are Not The Same

What’s a Mod?

Clock Math

Remainders and Clock Math

const x = 19 % 12; console.log(x);
const y = 19 % -12; console.log(y);

Spinning The Clock Backwards

This Is a Known Thing

So What?

  1. I can see this coming up in an interview question, catching me completely off guard and
  2. I can see pushing a bug live and spinning for hours trying to figure out why math doesn’t work

--

--

Author of The Imposter’s Handbook, founder of bigmachine.io, Cofounder of tekpub.com, creator of This Developer's Life, creator of lots of open source stuff.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rob Conery

Rob Conery

Author of The Imposter’s Handbook, founder of bigmachine.io, Cofounder of tekpub.com, creator of This Developer's Life, creator of lots of open source stuff.