over assign e = e , they do it as part of this statement because it is an idiom.
The operator checks if e exists, and if not, it initializes it with the expression that follows || . This works because when the expression || is evaluated, the interpreter stops evaluating when the first part of true (on the left).
In particular, if e evaluates to true , then the evaluation stops immediately and you have e = e , which is redundant. But if e is undefined or evaluates to false , then the right side || evaluated and assigned e .
I personally would use the if if instead of smart. Or, rebuild the code even further to avoid if at all.
EDIT: I think the source code is broken. Obviously, the goal is to check if e already initialized. But here it can be reassigned to itself if it is already initialized and evaluated as true . This can have unwanted side effects.
source share