---
title: "Comment by Purvi Barot on \"What is the !! (not not) operator in JavaScript?\" | Hashnode"
description: "!! converts the value to the right of it to its equivalent boolean value. (Think poor man&#39;s way of &quot;type-casting&quot;). Its intent is usually to conve"
url: "https://hashnode.com/posts/what-is-the-not-not-operator-in-javascript/60200cf4636acc2a3822fd93/comment/6020bb790da0382a2d49e57a"
---

[Discussion](https://hashnode.com/posts/what-is-the-not-not-operator-in-javascript/60200cf4636acc2a3822fd93)

Comment [What is the !! (not not) operator in JavaScript?](https://hashnode.com/posts/what-is-the-not-not-operator-in-javascript/60200cf4636acc2a3822fd93)

[Purvi Barot](https://hashnode.com/@purvi)

[Feb 8, 2021](https://hashnode.com/posts/what-is-the-not-not-operator-in-javascript/60200cf4636acc2a3822fd93/comment/6020bb790da0382a2d49e57a)

`!!` converts the value to the right of it to its equivalent boolean value. (Think poor man's way of "type-casting"). Its intent is usually to convey to the reader that the code does not care what value is in the variable, but what it's "truth" value is. So !! is not an operator, it's just the `!` operator twice.

Real World Example "Test IE version":

```
const isIE8 = !! navigator.userAgent.match(/MSIE 8.0/);  
console.log(isIE8); // returns true or false
```

If you:

```
console.log(navigator.userAgent.match(/MSIE 8.0/));  
// returns either an Array or null
```

But if you:

```
console.log(!!navigator.userAgent.match(/MSIE 8.0/));  
// returns either true or false
```
