![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the !! (not not) operator in JavaScript?
The double negation(!! ) operator is the! Operator twice and calculates the truth value of a value. It returns a Boolean value, which depends on the truthiness of the expression.
Consider (!!p) as !(!p), here’s an example:
If p is a false value, !p is true, and !!p is false. If p is a true value, !p is false, and !!p is true.
Here’s another example:
0 === false is false. !!0 === false is true. !!0 === false !!parseInt("foo") === false !!1 === true !!-1 === true !!false === false !!true === true
Advertisements