Javascript examples for Operator:Comparison Operators
Comparison Operators demo
<!DOCTYPE html>/*from w ww .j a v a 2s . c o m*/ <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = 5; document.getElementById("demo").innerHTML = (x <= 8); document.getElementById("demo").innerHTML += " "+ (x == 5); document.getElementById("demo").innerHTML += " "+ (x === "5"); document.getElementById("demo").innerHTML += " "+ (x === 5); document.getElementById("demo").innerHTML += " "+ (x != 8); document.getElementById("demo").innerHTML += " "+ (x !== "5"); document.getElementById("demo").innerHTML += " "+ (x !== 5); document.getElementById("demo").innerHTML += " "+ (x > 8); document.getElementById("demo").innerHTML += " "+ (x < 8); document.getElementById("demo").innerHTML += " "+ (x >= 8); document.getElementById("demo").innerHTML += " "+ (x <= 8);