if(first - second >=2 || first - second <=-2 || first - third >=2 || first - third <=-2 || second - third >=2 || second - third <=-2)
I have three values that have to be checked, and if any two of them have a >= 2 difference, then I run through some tasks.
I'm curious, can you suggest a way that would make this more pleasant? Thanks
if ( Math.max(first, second, third) - Math.min(first, second, third) >= 2 )
or a bit less efficient:
var a = [first, second, third].sort((a, b) => a - b)); if ( a - a >= 2 )