I often do this wrong: I want a number to bottom out at 0 — so that zero is the minimum value the number can be — so I do this:

number = Math.min(0, number)

Which is wrong. It should be:

number = Math.max(0, number)

But how to remember this?

No comments:

Post a Comment