DEV Community

[Comment from a deleted post]
Collapse
 
vonheikemen profile image
Heiker

Variables can help a lot in situations like this. I think code like that just needs context.

var notSaltyEnough = someSalt !== true;
var isModule = typeof module !== 'undefined';
var withinRange = (a+b<10 || a+b>0);
var canPrintMessage = (
  conditionA 
  && conditionB 
  && notSaltyEnough 
  && isModule 
  && a 
  && b 
  && withinRange
);

if (canPrintMessage) 
{
  console.log('Bye, World');
}