私は、論理AND演算子を理解するための参照フレームとして、MDNDocs-LogicalOperatorsを使用しています。
私はこれらのコード例のほとんど、特にここに示されている最初の4つを理解しました。
a1=true && true // t && t returns true
a2=true && false // t && f returns false
a3=false && true // f && t returns false
a4=false && (3 == 4) // f && f returns false
a5="Cat" && "Dog" // t && t returns Dog
a6=false && "Cat" // f && t returns false
a7="Cat" && false // t && f returns false
しかし、私は理解に問題がありますa5
、a6
そしてa7
。
a5="Cat" && "Dog"
2つの文字列がどのように評価されているのか理解できていませんtrue && true returns Dog
また、文字列「Cat」が一部としてtrueと評価されている理由も理解できていません。a6=false && "Cat" // f && t returns false