There are following types of operators in JavaScript.
1- Arithmetic Operators ( +,-,*,/,%,++,-- )
<script>
var a= 1;
var b = 2;
var c = a + b;
document.getElementById("demo").innerHTML = c;
</script>
2- Comparison (Relational) Operators (==,===,!=,!==,>,>=,<=)
<script type="text/javascript">
var a = 5;
var b = 8;
var linebreak = "<br />";
document.write("(a == b) => ");
result = (a == b);
document.write(result);
document.write(linebreak);
document.write("(a < b) => ");
result = (a < b);
document.write(result);
document.write(linebreak);
</script>
3-Bitwise Operators ( &,|,<<,>>,>>>, =>)
<script type="text/javascript">
<!--
var a = 2; //variable taken
var b = 3;
var linebreak = "<br />";
document.write("(a & b) => ");
result = (a & b);
document.write(result);
document.write(linebreak);
</script>
4-Logical Operators (&&,||,!)
<script type="text/javascript">
<!--
var x = true;
var y = false;
var linebreak = "<br />";
document.write("(x && y) => ");
result = (x && y);
document.write(result);
document.write(linebreak);
</script>
5-Assignment Operators (=,+=,-=,*=,/=)
<script>
var x = 10;
x += 4;
document.getElementById("demo").innerHTML = x;
</script>
0 Comment(s)