NOT(!) Logical Operator inJavaScript Last Updated : 14 Mar, 2023 Comments Improve Suggest changes Like Article Like Report JavaScript NOT Operator can be used to find the flipped value of a boolean. It can be used to convert a true value to a false and vice-versa. This NOT operator can also be used on non-booleans to convert them to the reverse of their actual boolean value. A NOT operator can be used with another NOT operator to get the original value back. Syntax: !a Return Type: Flipped boolean value. Example 1: In this example, we will use the NOT operator on some boolean and other data types. JavaScript console.log(!true); console.log(!false); console.log(!"1"); console.log(!""); console.log(!null); Output: We can see that the values converted to true are flipped and false is returned and vice versa. false true false true true Example 2: In this example, we will use two NOT operators on the same boolean and other data types. JavaScript console.log(!!true); console.log(!!false); console.log(!!"1"); console.log(!!""); console.log(!!null); Output: When we applied the NOT operator two times we got the original boolean value back. true false true false false Supported Browsers: ChromeEdgeFirefoxSafariOpera We have a complete list of JavaScript Logical Operators, to learn about those please go through JavaScript Logical Operator article. Comment More infoAdvertise with us Next Article AND(&&) Logical Operator in JavaScript S shobhit_sharma Follow Improve Article Tags : JavaScript Web Technologies Similar Reads JS Arithmetic OperatorsJavaScript Addition (+) OperatorJavaScript addition (+) operator is one of the most fundamental and widely used arithmetic operators in JavaScript. It is used to perform arithmetic addition on numbers but also concatenate strings. Syntaxa + bWhere - a: The first value (number, string, or another data type).b: The second value (num 1 min read Subtraction(-) Arithmetic Operator in JavaScriptJavaSscript arithmetic subtraction operator is used to find the difference between operators after subtracting them. Depending on the nature of the two operands, the subtraction operator performs either number subtraction or BigInt subtraction after converting both operands to numeric values. Syntax 1 min read Multiplication(*) Arithmetic Operator in JavaScriptJavaScript arithmetic multiplication operator is used to find the product of operands. Like if we want the multiplication of any two numbers then this operator can be useful. Syntax: a*b Return: It returns the roduct of the operands. Example 1: In this example, we will perform multiplication on Numb 1 min read Division(/) Arithmetic Operator in JavaScriptJavaScript airthmetic division operator is used to find the quotient of operands. The left operator is treated as a dividend and the right operator is treated as a divisor. Syntax: a/bReturn Type: It returns the quotient of the operands Example 1: In this example, we will perform basic division on N 1 min read Modulus(%) Arithmetic Operator in JavaScriptThe modulus (%) arithmetic operator in JavaScript returns the remainder after dividing one number by another. It is used for tasks like determining even or odd numbers, cycling through values within a range, and managing periodic events in programming. Syntax: a%bReturn Type: Remainder of the operan 1 min read Exponentiation(**) Arithmetic Operator in JavaScriptJavaScript exponentiation(**) operator in JavaScript is represented by "**" and is used to find the power of the first operator raised to the second operator. This operator is equal to Math.pow() but makes the code simpler and can even accept BigInt primitive data type. The exponentiation operator i 2 min read Increment(+ +) Arithmetic Operator in JavaScriptJavaScript increment(+ +) operator is used to increase the value of the variable by one. The value returned from the operand depends on whether the increment operator was on the left(prefix increment) or right(postfix increment). If the operator is used before the operand then the value is increased 1 min read Decrement(--) Arithmetic Operator in JavaScriptJavaScript decrement operator is used to decrease the value of the variable by one. The value returned from the operand depends on whether the decrement operator was on the left(prefix decrement) or right(postfix decrement). If the operator is used before the operand then the value is decreased by o 2 min read JavaScript Arithmetic Unary Plus(+) OperatorThe Unary plus(+) operation is a single operand operator (which means it worked with only a single operand preceding or succeeding to it), which is used to convert its operand to a number, if it isn't already a number. Syntax: +Operand Below examples illustrate the Unary plus(+) Operator in JavaScri 1 min read JavaScript Arithmetic Unary Negation(-) OperatorThe Unary negation(-) operation is a single operand operator (which means it worked with only a single operand preceding or succeeding to it), which is used to convert its operand to a negative number, if it isn't already a negative number. Syntax: -Operand Example 1: This example shows the use of J 1 min read JS Assignment OperatorsAddition Assignment (+=) Operator in JavascriptJavaScript Addition assignment operator(+=) adds a value to a variable, The Addition Assignment (+ =) Sums up left and right operand values and then assigns the result to the left operand. The two major operations that can be performed using this operator are the addition of numbers and the concaten 2 min read Subtraction Assignment( -=) Operator in JavascriptThe Subtraction Assignment Operator( -=) is used to subtract a value from a variable. This operator subtracts the value of the right operand from a variable and assigns the result to the variable, in other words, allows us to decrease the left variable from the right value. Syntax: a -= b We will no 1 min read Multiplication Assignment(*=) Operator in JavaScriptMultiplication Assignment Operator(*=) in JavaScript is used to multiply two operands and assign the result to the right operand. Syntax: variable1 *= variable2 // variable1 = variable1 * variable2 Example 1: In this example, we multiply two numerical values using the Multiplication Assignment Opera 1 min read Division Assignment(/=) Operator in JavaScriptJavaScript Division Assignment Operator in JavaScript is represented by "/=". This operator is used to divide the value of the variable by the value of the right operand and that result is going to be assigned to the variable. This can also be explained as dividing the value of the variable by an ex 1 min read JavaScript Remainder Assignment(%=) OperatorJavaScript remainder assignment operator (%=) assigns the remainder to the variable after dividing a variable by the value of the right operand. Syntax: Operator: x %= y Meaning: x = x % y Below example illustrate the Remainder assignment(%=) Operator in JavaScript: Example 1: The following example 1 min read Exponentiation Assignment(**=) Operator in JavaScriptJavaScript Exponentiation Assignment Operator in JavaScript is represented by "**=". This operator is used to raise the value of the variable to the power of the operand which is right. This can also be explained as the first variable is the power of the second operand. The exponentiation operator i 1 min read Left Shift Assignment (<<=) Operator in JavaScriptThe Left Shift Assignment Operator is represented by "<<=". This operator moves the specified number of bits to the left and assigns that result to the variable. We can fill the vacated place by 0. The left shift operator treats the integer stored in the variable to the operator's left as a 32 2 min read Right Shift Assignment(>>=) Operator in JavaScriptThe Right Shift Assignment Operator is represented by ">>=". This operator shifts the first operand to the right and assigns the result to the variable. It can also be explained as shifting the first operand to the right in a specified amount of bits which is the second operand integer and the 1 min read Bitwise AND Assignment (&=) Operator in JavaScriptThe Bitwise AND Assignment Operator is represented by "&=". This operator uses the binary representation of both operands and performs the bitwise AND operation and then assigns the result to the left operand. This can also be explained as applying the logical AND operation to the first operand 1 min read Bitwise OR Assignment (|=) Operator in JavaScriptThe Bitwise OR Assignment Operator in JavaScript is represented by (|=). This operator is used to perform a bitwise OR operation on both operands and assign the result to the left operands. Syntax: a |= b Where - a = First operandb = Second operand Example 1: In this example, we will use basic numer 2 min read Bitwise XOR Assignment (^=) Operator in JavaScriptThe Javascript Bitwise XOR assignment is represented by (^=). It is used to perform a bitwise XOR operation on both operands and assign the result to the left operand. Syntax: a ^= b // a = a ^ b Where - a = First operandb = Second operand Example: In this example, we will perform the basic Bitwise 2 min read JavaScript Logical AND assignment (&&=) OperatorThis operator is represented by x &&= y, and it is called the logical AND assignment operator. It assigns the value of y into x only if x is a truthy value. We use this operator x &&= y like this. Now break this expression into two parts, x && (x = y). If the value of x is tr 2 min read JavaScript Logical OR assignment (||=) OperatorThis operator is represented by x ||= y and it is called a logical OR assignment operator. If the value of x is falsy then the value of y will be assigned to x. When we divide it into two parts it becomes x || ( x = y ). It checks if x is true or false, if the value of x is falsy then it runs the ( 2 min read Nullish Coalescing Assignment (??=) Operator in JavaScriptThis is a new operator introduced by javascript. This operator is represented by x ??= y and it is called Logical nullish assignment operator. Only if the value of x is nullish then the value of y will be assigned to x that means if the value of x is null or undefined then the value of y will be ass 2 min read JS Comparison OperatorsEquality(==) Comparison Operator in JavaScriptIn JavaScript, the Comparison Equality Operator is used to compare the values of the operand. The comparison operator returns true only if the value of two operands are equal otherwise it returns false. It is also called a loose equality check as the operator performs a type conversion when comparin 2 min read Inequality(!=) Comparison Operator in JavaScriptJavaScript Inequality operator is used to compare two operands and returns true if both the operands are unequal it is basically the opposite of the Equality Operator. It is also called a loose inequality check as the operator performs a type conversion when comparing the elements. Also in the case 2 min read Strict Equality(===) Comparison Operator in JavaScriptJavaScript Strict Equality Operator is used to compare two operands and return true if both the value and type of operands are the same. Since type conversion is not done, so even if the value stored in operands is the same but their type is different the operation will return false. Syntax: a===b E 2 min read Strict Inequality(!==) Comparison Operator in JavaScriptJavaScript Strict Inequality Operator is used to compare two operators and return true if they both are unequal. It is the opposite of the Strict Equality operator but like the Strict Equality Operator, it also does not perform type conversion. Syntax: a!==b Example 1: In this example, we will use t 1 min read Greater than(>) Comparison Operator in JavaScriptJavaScript Greater Than(>) Operator is used to compare two operands and return true if the left operand has a higher value than the right operator. Syntax: a>bExample 1: In this example, we will compare String, Number, and Boolean using Greater Than Operator. JavaScript console.log("3 1 min read Greater Than or Equal(>=) Comparison Operator in JavaScriptJavaScript Greater Than or Equal Operator(>=) is used to compare two operands and return true if the left operand has a value greater than or equal to the right operand. The algorithm used in the comparison is similar to that of less than comparison the only difference is that the values are swap 1 min read Less Than(JavaScript Less Than(<) Operator is used to compare two operands and return true if the left operand has a lesser value than the right operator. The values are converted to equal primitive types before conversion If both the values are strings the comparison is done on the basis of their Unicode. 1 min read Less Than or Equal(JavaScript Less Than or Equal(<=) to the operator is used to compare two operands and return true if the left operand is smaller or equal to the right operand. The algorithm used for the comparison is the same as that of less than operator but equal condition is also checked Syntax: a<=b Examp 1 min read JS Logical OperatorsNOT(!) Logical Operator inJavaScriptJavaScript NOT Operator can be used to find the flipped value of a boolean. It can be used to convert a true value to a false and vice-versa. This NOT operator can also be used on non-booleans to convert them to the reverse of their actual boolean value. A NOT operator can be used with another NOT o 1 min read AND(&&) Logical Operator in JavaScriptThe logical AND (&&) (logical conjunction) operator for a set of boolean operands will be true if and only if all the operands are true. Otherwise, it will be false. It's commonly used to combine conditions in conditional statements or to check multiple conditions before executing code. The 1 min read OR(||) Logical Operator in JavaScriptThe logical OR (||) (logical disjunction) operator for a set of operands is true if and only if one or more of its operands is true. It evaluates two expressions and returns true if at least one is true, otherwise, it returns false. This operator is frequently used in conditional statements to execu 1 min read JS Bitwise OperatorsAND(&) Bitwise Operator in JavaScriptJavaScript Bitwise AND(&) operator is used to compare two operands by performing an AND operation on the individual bits and returning 1 only if both the bits are one. The AND(&) Operator has a lot of real-world applications and the most famous one is to check whether a number is even or odd 2 min read OR(|) Bitwise Operator in JavaScriptJavaScript Bitwise OR(|) Operator is used to compare two operands by performing OR operation on individual bits of the operands and returns true even if one of the compared bits is 1. The OR Operator has vast applications and the most used one is combining bit values. The operation is represented by 2 min read XOR(^) Bitwise Operator in JavaScriptIn JavaScript, the bitwise XOR(^) Operator is used to compare two operands and return a new binary number which is 1 if both the bits in operators are different and 0 if both the bits in operands are the same. The operation is represented by the "^" symbol. This operator can be used to find the miss 2 min read NOT(~) Bitwise Operator in JavaScriptJavaScript NOT(~) Operator is used to invert the bits of a number. The operator is represented by "~" symbol. It is a unary operator since it requires only one operand to operate. There are various uses of the Bitwise NOT operator which include bit-masking, finding two's complement as well as error 1 min read Left Shift (JavaScript Left Shift Operator is used to operate on the two operands. The first operand is the number and the right operand specifies the number of bits to shift to the left. The operation is represented by the "<<" symbol. Mainly the left shift operator is used to multiply the number by any 2 min read Right Shift (>>) Bitwise Operator in JavaScriptJavaScript bitwise right shift operator is used to operate on two operands where the left operand is the number and the right operand specifies the number of bits to shift towards the right. A copy of old leftmost bits is maintained and they have added again the shifting is performed. The sign bit i 2 min read Zero Fill Right Shift (>>>) Bitwise Operator in JavaScriptJavaScript Zero Fill Right Shift Operator or Unsigned Right Shift Operator(>>>) is used for operating on the two operands. The first operand is the number and the right operand specifies the bits to shift towards the right modulo 32. In this way, the excess bits which are shifted towards th 2 min read JS Unary OperatorsJavaScript typeof OperatorThe typeof operator in JavaScript is used to determine the data type of a value or variable. It returns a string indicating the type, such as "string", "number", "boolean", "object", etc.JavaScriptconsole.log(typeof "Hello"); console.log(typeof 42); console.log(typeof true); console.log(typeof {}); 3 min read JavaScript delete OperatorThe delete operator in JavaScript removes properties from objects, including inherited ones, and creates holes in arrays without changing their length. If a deleted property holds an object with no other references, that object is automatically released by JavaScript's garbage collector over time.Sy 3 min read JS Relational OperatorsJavaScript in OperatorJavaScript in operator is an inbuilt operator which is used to check whether a particular property exists in an object or not. It returns a boolean value true if the specified property is in an object, otherwise, it returns false. Syntax:prop in objectParameters: prop: This parameter holds the strin 2 min read JavaScript Instanceof OperatorThe instanceof operator in JavaScript is used to check the type of an object at run time. It returns a boolean value if true then it indicates that the object is an instance of a particular class and if false then it is not. Syntax:let gfg = objectName instanceof objectTypeParameters: objectName: S 2 min read JS Other OperatorsJavaScript String OperatorsJavaScript String Operators are used to manipulate and perform operations on strings. There are two operators which are used to modify strings in JavaScript. These operators help us to join one string to another string.1. Concatenate OperatorConcatenate Operator in JavaScript combines strings using 3 min read JavaScript yield OperatorThe yield operator in JavaScript is used to hand over control of a generator function to another generator function or iterable object. It's handy for yielding values from an inner generator or iterable object within an outer generator function. This operator finds application in tasks like working 3 min read JavaScript Pipeline OperatorThe JavaScript Pipeline Operator (|>) is used for passing the result of one expression into a function. It's particularly useful for making long chains of functions easier to read. With this operator, the value before it gets sent as input to the function that follows. You simply arrange the func 2 min read JavaScript Grouping OperatorThe Grouping operator consists of a pair of parentheses around an expression or sub-expression to override the normal operator precedence so that expressions with lower precedence can be evaluated before an expression with higher priority. This operator can only contain expressions. The parameter li 2 min read Like