</> Code Corner

JavaScript · JS Tutorial · Lesson 9

JS Operators

Arithmetic, assignment, comparison and logical operators.

JavaScript operators are used to perform different types of mathematical and logical computations.

Example

<p id="demo"></p>
<script>
let a = 10, b = 3;
let out = "";
out += "a + b = " + (a + b) + "<br>";
out += "a % b = " + (a % b) + "<br>";
out += "a ** 2 = " + (a ** 2) + "<br>";
out += "a > b is " + (a > b) + "<br>";
out += "5 == \"5\" is " + (5 == "5") + "<br>";
out += "5 === \"5\" is " + (5 === "5") + "<br>";
out += "true && false is " + (true && false);
document.getElementById("demo").innerHTML = out;
</script>
Type Operators
Arithmetic + - * / % ** ++ --
Assignment = += -= *= /= %=
Comparison == === != !== > < >= <=
Logical && || !
Type typeof instanceof

Keep reading “JS Operators”

Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.

Chat with us 👋