Tech Study

JavaScript OR (||) Operator | Logical OR assignment

JavaScript OR

JavaScript OR Operator is used to perform logical OR operations on two Boolean operands. OR Operator is generally used in creating complex conditions like combining two or further simple conditions.

The symbol used for JavaScript OR Operator is ||. The syntax to use JavaScript OR Operator with operands “a” and “b” is “a||b”. JavaScript OR Operator supports chaining. For illustration, the syntax to pen a condition with four Boolean valuations is a|| b|| c|| d. These expressions return true if any of the operands is true. The following verity table provides the output of the JavaScript OR operator for different values of operands.

a b a || b
True True True
True False True
False True True
False False False

JavaScript OR Operation returns true if any of the operands is true, otherwise, it returns false.

In the following illustration, we use logical OR Operator in the If Statement’s Condition to fuse two simple conditions to form a complex condition.


     var a = 4;

     if (a % 2 == 0 || a > 0) {

         document.getElementById('output').innerHTML += 'a is either greater than zero or even.';

     } else {

            document.getElementById('output').innerHTML += 'a is neither greater than zero nor even.';



Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more