|| and && will first perform a conditional judgment on the first operand, if it is not a Boolean value, it will first be converted to a Boolean type, and then the conditional judgment will be performed.
||
For ||, if the condition evaluates to true, it returns the value of the first operand, and if it is false, it returns the value of the second operand.
For example
console.log(1 || null);//1
console.log(null || undefined);//undefined
&&
&& is the opposite. If the condition is true, it returns the value of the second operand, and if it is false, it returns the value of the first operand.
For example
console.log(1 && null);//null
console.log(null && undefined);//null
Summarize
|| and && return the value of one of their operands, not the result of the condition