&& and || as conditional statements
suggest changeThe operators || and && short-circuit. || skips the right-hand side when the left-hand side is truthy, and && skips it when the left-hand side is falsy. That can express a short conditional. In a browser:
const x = 10
x == 10 && alert("x is 10")
x == 10 || alert("x is not 10")
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents