I’ve been the same as James for years:
In the past, I would just try
b - a
then trya - b
and pick which one gave me the result I wanted. But now I have a mental model simple enough for me to remember.
Well, to be honest, this is that I ask GPT to work out for me these days 😬
Either way, James explains how the Array.sort()
function works beautifully in this article. What a lovely looking blog too!