&& and || are particularly widely used in the JQuery source code. Since I have not systematically learned js, I can only roughly understand it myself. I hope you can give me some guidance.
A rough understanding is as follows:
a() && b(): If true is returned after executing a(), then b() is executed and the value of b is returned; if false is returned after executing a(), Then the entire expression returns the value of a(), and b() is not executed;
a() || b(): If true is returned after executing a(), the entire expression returns the value of a(), b () is not executed; if false is returned after executing a(), b() is executed and the value of b() is returned;
&& has a higher priority than ||
as follows:
Code