What is the !! (not not) Operator in JavaScript? Last Updated : 04 Oct, 2024 Comments Improve Suggest changes Like Article Like Report The !! (double negation) operator is a repetition of the unary logical "not" (!) operator twice. It is used to determine the truthiness of a value and convert it to a boolean (either true or false). Here’s how it works:The single ! (logical "not") inverts the truth value of a given expression:!false becomes true, because "false is not true."!true becomes false, because "true is not false."The double negation !! reverses this inversion, converting a value to its boolean equivalent:!!true returns true, because "true is not not true."!!false returns false, because "false is not not false."In essence, !! forces a value into its corresponding boolean form, reflecting its inherent truthiness.Example 1: This example checks the truthiness of the boolean value true. javascript // Declare a variable using let let n1; /* Checking the truthiness of the boolean value true using !! */ n1 = !!true; // Log the result to the console console.log(n1); Outputtrue Example 2: This example checks the falsyness of the boolean value false. JavaScript // Declare a variable using let let n1; // Checking the falsiness of the boolean value false using !! n1 = !!false; // Output the result using console.log console.log(n1); Outputfalse Example3: This example checks the truthyness or falsyness of a given string. JavaScript // Write Javascript code here let n1; // checking the truthiness of a given string. n1 = !!"Javascript programming"; // Output the result (which will be true) // using console.log console.log(n1); Outputtrue Example 4: This example checks the truthyness or falsyness of a given object. JavaScript // Write Javascript code here let n1; // checking the truthiness // of a given object. n1 = !!{ articles: 70 }; // Output the result (which will be true) using console.log console.log(n1); Outputtrue Comment More infoAdvertise with us Next Article What is the !! (not not) Operator in JavaScript? C chaitanyashah707 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Questions Similar Reads What is (~~) "double tilde" operator in JavaScript ? This is a special kind of operator in JavaScript. To understand the double tilde operator, first, we need to discuss the tilde operator or Bitwise NOT. The (~) tilde operator takes any number and inverts the binary digits, for example, if the number is (100111) after inversion it would be (011000). 3 min read NOT(!) Logical Operator inJavaScript 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 o 1 min read NOT(~) Bitwise Operator in JavaScript JavaScript 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 What does OR Operator || in a Statement in JavaScript ? JavaScript is a dynamic programming language that allows developers to write complex code with ease. One of the fundamental concepts in JavaScript is the use of operators, which are symbols that perform operations on one or more values. One such operator is the || (logical OR) operator, which can be 6 min read JavaScript in Operator JavaScript 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 Less Than(<) Comparison Operator in JavaScript 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 Explain the purpose of the âinâ operator in JavaScript JavaScript in operator is used to check whether the data is within the object or in an array. In an object, the in operator works only on the key or property of the object. If the key or property exists then this operator returns true otherwise false. Similarly, for arrays, it will return true if we 2 min read JavaScript Ternary Operator The Ternary Operator in JavaScript is a shortcut for writing simple if-else statements. Itâs also known as the Conditional Operator because it works based on a condition. The ternary operator allows you to quickly decide between two values depending on whether a condition is true or false.Syntax:con 5 min read OR(||) Logical Operator in JavaScript The 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 What is JavaScript >>> Operator and how to use it ? The JavaScript >>> represents the zero-fill right shift operator. It is also called the unsigned right-bit shift operator. It comes under the category of Bitwise operators. Bitwise operators treat operands as 32-bit integer numbers and operate on their binary representation. Zero-fill right 3 min read Like