Operator is a special symbol used for performing a specific task. e.g. A+B. Here + symbol represents the operator.
Types of javascript operators:
- Javascript Arithmatic Operators
- Javascript Comparison Operators
- Javascript Bitwise Operators
- Javascript Logical Operators
- Javascript Assignment Operators
- Javascript Special Operators
Example:
<!DOCTYPE html> <html> <body> <h2>JavaScript Operators Test</h2> <script> var num1 = 5, num2 = 10, num3 = 15; document.write(num1+num2); document.write("</br>"); document.write(num2-num1); document.write("</br>"); document.write(num1*num2); document.write("</br>"); document.write(num2/num1); document.write("</br>"); document.write(num1%2); document.write("</br>"); num3++; document.write(num3); document.write("</br>"); num2--; document.write(num2); </script> </body> </html>