
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How to use OR condition in a JavaScript IF statement?
To use OR condition in JavaScript IF statement, use the || operator i.e Logical OR operator. If any of the two operands are non-zero, then the condition becomes true.
Here’s how you can use the operator || in JavaScript
Example
<html> <body> <script> var a = true; var b = false; document.write("(a || b) => "); result = (a || b); document.write(result); </script> </body> </html>
- Related Articles
- How to comment each condition in a multi-line if statement in Python?
- How to use “OR” condition in MySQL CASE expression?\n
- How to use if/else condition in select in MySQL?
- How to use nested if statement in Python?
- How to use IF statement in MySQL using Python?
- How do we use throw statement in JavaScript?
- How can I use goto statement in JavaScript?
- How to show if...else statement using a flowchart in JavaScript?
- How to write an inline IF statement in JavaScript?
- How to use multiple conditions in one if statement in Python?
- How to use the break statement to come out of a loop in JavaScript?
- How can I use a label with break statement in JavaScript?
- How can I use a label with continue statement in JavaScript?
- Converting decimal to binary or hex based on a condition in JavaScript
- How to recognize when to use : or = in JavaScript?

Advertisements