
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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>
Advertisements