Różne operatory

Operatory logiczne

<script>
var a = true;
var b = false;
document.write("<pre>");
document.write("a = " + a + "\n");
document.write("b = " + b + "\n\n");
document.write("!a     = " + !a + "\n");       // negacja logiczna
document.write("a || b = " + (a || b) + "\n"); // suma logiczna
document.write("a && b = " + (a && b));        // iloczyn logiczny
document.write("</pre>");
</script>

Operatory porównań

<script>
document.write("<pre>");
document.write("1 == 1    = " + (1 == 1) + "\n");
document.write("1 == \"1\"  = " + (1 == "1") + "\n");
document.write("1 != \"1\"  = " + (1 != "1") + "\n\n");
document.write("1 === 1   = " + (1 === 1) + "\n");
document.write("1 === \"1\" = " + (1 === "1") + "\n");
document.write("1 !== \"1\" = " + (1 !== "1") + "\n");
document.write("</pre>");
</script>

Operator warunkowy

<script>
var a = 2;
var b = 3;
document.write("<p>");
document.write("a = " + a + "<br>");
document.write("b = " + b + "<br>");
document.write(a < b ? "a < b" : "a >= b");
document.write("</p>");
</script>

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators

Strona glówna