I want to test whether a variable is equal to another variable, or within +5 or -5 that other variable. What's the most succinct way to write this?
if(foo === bar || foo === bar + 5 || foo === bar - 5) { // do stuff };
Not only is this long but it won't evaluate to true if foo = bar + 4, or bar + 3 etc.