Bitwise operators
these are to evaluate bit based operations. Sometimes it is required to evaluate bits of integer values, We have to use bitwise operators. There are sevaral operators like in many programming languages. This operator work with 32 bits of an integer
Syntax Operand Operator Operand2
Let assume that Value of A and B are 5 and 10
Operator
Title
Description
Example
&
Bitwise ANd
Evaluates And operation on bits Integers parameters
A & B is 0

Bitwise OR
Evaluates Or operation on bits Integers parameters
A  B is 15
^
Bitwise XOR
Evaluates exclusive operation on bits of Integers parameters
A ^ B is 15
~
Bitwise NOT
Not operator on bits of parameter
~A is 6
«
Left Shifts
First shifts left bits of the first opernad by second oeprand times and remaining bits will be filled with zero
A<
>>
Right Shifts
First shifts right bits of the first opernad by second oeprand times and remaining bits will be filled with zero
A»B is 0
>»
Right Shifts with zero
Evaluation is right shift + left Bits shifted replaced with zero
A»>B is 0
Example
var A = 5
var B = 10
console.log(A & B) // returns 0
console.log(A  B) // returns 15
console.log(~A) // returns 6
console.log(A^B) // returns 15
console.log(A<**>B) // returns 0
console.log(A>>>B) // returns 0
**
Assignment Operators
Assignment operators do some operations and assign the value from left to right values
Syntax
Operand1 Assignmentoperator Operand2
Operator
Title
Description
Example
=
Simple assign
Evaluates And operation on bits Integers parameters
a=2 and value of a is 2
+=
Add And assign
Add right operand to left and assign the result to left operand
a+=2 and value of a is equal to a=a+2
=
Subscrtract and assign
Subtract right operand to left and assign the result to left operand
a=2 and value of a is equal to a=a+2
*=
Multiply And assign
Multiply right operand with left and assign the result to left operand
a*a=2 is equal to a=a*2
/=
Divide and assign
Divide right operand with left and assign the result to left operand
c/=2 is equal to c=c/2
%=
Modulus And Assign
Divide right operand with left and assign the result of the remainder to left operand
c%=2 is equal to c=c%2
«=
Left Shifts And assign
Perform left shift and result is assigned to left operand
c«=2 is equal to c=c«2 td="">
>>=
Right Shifts And assign
Perform Right shift and result is assigned to left operand
c»=2 is equal to c=c»2
&=
Bitwise And Assign
Perform Bitwise And and the result is assigned to left operand
c&=2 is equal to c=c&2
^=
Bitwise Exclusive And Assign
Perform Bitwise Exclusive OR and result is assigned to left operand
c^=2 is equal to c=c^2
=
Bitwise Or And Assign
Perform Bitwise inclusive OR and the result is assigned to left operand
c=2 is equal to c=c2
Comma Operator
This operator symbol is,(comma). This is used to perform the multiple expressions and return the last expression value. Multiple expression is evaluated from left to right.
Syntax : (Operand/Expression,Operand2) Example
var variable =10;
variable = (variable, variable);
console.log(variable); // outputs 9