The goal is to prevent an assignment if you enter a single '=' by mistake.
var a = 2;
if (a = 1) alert('Oops');
Witing:
if (1 = a)
will result in:
Invalid left-hand side in assignment
You can achieve this with a good linter, and skip the unnatural looking expression.