OR operator (||) returns true if one or both expressions are true, otherwise it returns false. - Javascript Operator

Javascript examples for Operator:Boolean Operator

Description

OR operator (||) returns true if one or both expressions are true, otherwise it returns false.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
var x = 6;//from ww  w.  j  a va 2s.  c o m
var y = 3;

document.getElementById("demo").innerHTML =
(x === 5 || y === 5) + "<br>" +
(x === 6 || y === 5) + "<br>" +
(x === 6 || y === 3);
</script>

</body>
</html>

Related Tutorials