为什么 0 && 布尔值的计算结果为 0 而不是布尔值?

Why does 0 && a Boolean evaluate to 0 instead of the Boolean?

为什么 0 && 和布尔值的计算结果为 0 而不是布尔值?

0 && false
> 0
0 && true
> 0

But false && 0 returns false and true && 0 returns true

false && 0
> false

我认为数值和假表达式总是 return 布尔值。

1 && false
> false

参见the documentation from MDN

the && and || operators actually return the value of one of the specified operands, so if these operators are used with non-Boolean values, they may return a non-Boolean value

expr1 && expr2: Returns expr1 if it can be converted to false; otherwise, returns expr2.

由于0可以转为false,而0expr1,所以returns 0.