OR Logical Operator
The ||
(OR) operator is used for defining the "or" relation between two or more expressions.
It returns true if any of the expressions evaluate to true
.
Example:
12345let a = 9; if(a < 10 || a > 30) { console.log("Condition Matched"); }
The above code output "Condition Matched"
when a is less than 10 OR a is greater than 30.
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Can you explain the difference between the And and Or operators again?
Can you give more examples of using the Or operator?
When should I use the Or operator instead of the And operator?
Awesome!
Completion rate improved to 1.33
OR Logical Operator
Swipe to show menu
The ||
(OR) operator is used for defining the "or" relation between two or more expressions.
It returns true if any of the expressions evaluate to true
.
Example:
12345let a = 9; if(a < 10 || a > 30) { console.log("Condition Matched"); }
The above code output "Condition Matched"
when a is less than 10 OR a is greater than 30.
Thanks for your feedback!