Comparison operators are used in logical statements to determine whether variables or values are equal.
Logical operators are used to determine logic between variables or values.
Conditional operators that javaScript assigns values to variables based on certain conditions (tritermes).
HTML:
<! DOCTYPEhtml>
<html>
<head>
<meta charset="utf-8">
<title>Comparison operator</title>
</head>
<body>
<p>test</p>
<p>Click the button to detect age.</p>Age:<input id="age" value="18" />
<p>Are you of voting age?</p>
<button onclick="myFunction()">Let me test</button>
<p id="demo"></p>
<script>
function myFunction(){
/* The comparison operator */
var x=5;
/ / = = equal to zero
document.getElementById("demo").innerHTML=x==8;//false
document.getElementById("demo").innerHTML=x==5;//true
// === =
document.getElementById("demo").
Copy the code