All about JavaScript Operators and its types
All about JavaScript Operators and its types
JavaScript
needs no further introduction. Being an important programming language of the
programming world, it had been ruling since ages. It is known to be the
high-level and interpreted programming language that is used to make
interactive web pages. Many times, when websites failed to create the desired
engagement or developers want it to be more creative, JavaScript is uses to get
the missing things on track. It can be used to enhance the web pages,
applications by providing more and interactive user-friendly experience.
Learning
JavaScript is also easy. It is easy to learn and quite simple to implement.
Thus, learners who want to learn how to use JavaScript can learn it anyhow and
anytime.
While
learning JavaScript, there’s one term that needs attention of the learners.
It’s the JavaScript operators. It is an important part that calls for support
from JavaScript. To perform some mathematical or computational calculations,
operators are used and JavaScript operators have their own history.
What is a JavaScript Operator?
Generally,
an operator is used to manipulate a certain value or operand. An operator is
used to perform some kind of mathematical and logical calculations on operands.
In short, you can take it as an operator is used to operate the operands.
Operators
are used to compare the values and perform arithmetic operations. For example,
if you will write 4+5=9, here 4, 5 are the operands while ‘+’ are the operator.
In JavaScript, various operators are used to perform different operations. Each
and every operator had its own specialty and known for performing a separate
type of calculation or operation.
Types of JavaScript operators
There
are different types of operators available in JavaScript. Here they are:
Arithmetic
Operators:
As the name suggests, these types of operators are used to perform the
arithmetic operations. Here are few operators that are taken as JavaScript
arithmetic operators.
‘+’-
it adds two operands
‘-‘-
it helps in subtracting the second operand from the first
‘/’-
it divides the numerator by the denominator
‘*’-
it multiples two operands
%-
it generate the output of the integer division
++-
It increases an integer value by one
‘—‘-
It decreases and integer value by one
Comparison
Operators:
this JavaScript operator compares the two operands. Here are few comparison
operators.
‘==’-It checks
whether the two operands are equal or not. Statement will turn true if the
operands are equal. ‘===’-It finds the
identical ‘!=’-Checks if two
operands are equal or not. The condition sets true if the values are not
equal. ‘!==’-It implies that
the values are unidentical ‘>’-Checks if the
value of the left operand is greater than the right one. ‘>=’-Checks if the
value of the left operand is greater than or equal to the right one. ‘<’-This Checks if
the value of the left operand is less than the value of the right operand ‘<=’-Checks if the
value of the left operand is less than or equal to the value of the right
operand |
|
Bitwise
Operators: these
JavaScript bitwise operators are used to perform bitwise operations on
operands. The list includes: &: Boolean AND
operation on each bit of its integer arguments |: It performs a
Boolean OR operation on each bit of its integer arguments ^:This operator
performs Bitwise XOR operation ~: It is a unary
operator and operates by reversing all the bits in the operand <<: Moves all the
bits in its first operand to the left by the number of places specified in
the second operand. >>: The left
operand’s value is moved right by the number of bits specified by the right
operand. Logical Operators: these are the
operators that help in performing logical computations. The list includes. &&:
Logical AND
– If both the operands are non-zero, then the condition becomes true ||: Logical OR – If any of
the two operands are non-zero, then the condition is fine. !: Logical NOT – Reverses
the logical state of its operand. Assignment
Operators: as the name
suggests, this JavaScript operators are known for assigning values to the
operand.
|
JavaScript
operators are quite helpful in performing all types of mathematical and logical
computations. One can use them as and when needed.
Apply for Java Training in Gurgaon
Comments