【リーダブルコード】条件式の並び順はどのように決めるか

【JavaScript】ドルモガンの法則(DeMorgan’s laws)とは

【JavaScript】ドルモガンの法則(DeMorgan's laws)とは

論理式を等価な式に置き換える2つの方法

1) not (a or b or c) は (not a) and (not b) and (not c)
2) not (a and b and c) は (not a) or (not b) or (not c)

notを分配して and / or を反転する
逆は
not をくくり出す

[code language="javascript"]
if(!(file_exists && !is_protected)) console.log("Sorry, could not read file");
//以下のように書き換えられる

if(!file_exists || is_protected) console.log("Sorry, could not read file");

[/code]

参照: リーダブルコード

ここも
https://www.i-programmer.info/programming/theory/4977-dangerous-logic-de-morgan-a-programming.html

The first law is that
NOT( A AND B) = NOT A OR NOT B

The second law you can probably guess:
NOT(A OR B) = NOT A AND NOT B
//式の前のNOTを分配してORをANDに