---
title: "Discussion on \"What are Double shots ( !! ) in JavaScript ?\" | Hashnode"
description: "Discussion on \"What are Double shots ( !! ) in JavaScript ?\". What is !! in JavaScript ? where & how we can use it ? Let's discuss some feature of !! \"Double Shots or Double Exclamation\" in JavaScript.\nSo where it can be helpful, let's say we have some production grade application where we have some code that g..."
url: "https://hashnode.com/posts/what-are-double-shots-in-javascript/5f549038d34e0b0a2135b9ba"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [What are Double shots ( !! ) in JavaScript ?](https://axay.hashnode.dev/what-are-double-shots-in-javascript?utm_source=hashnode&utm_medium=feed)

What is !! in JavaScript ? where & how we can use it ? Let's discuss some feature of !! "Double Shots or Double Exclamation" in JavaScript. So where it can be helpful, let's say we have some production grade application where we have some code that g...

Sep 6, 2020 · 3 min read · axay.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#coding](https://hashnode.com/tag/coding)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#best-practices](https://hashnode.com/tag/best-practices)

## Written by

[Akshay Sushir](https://hashnode.com/@axay)

@axay

  
[View profile](https://hashnode.com/@axay)

Full Stack Developer

I'm full stack developer. JavaScript &amp; Python enthusiast. I like to build software projects using JavaScript &amp; Python.

## Responses 2

Markdown supported · ⌘↵ to post

[George Jempty (Dexygen)](https://hashnode.com/@dexygen)

[Sep 6, 2020](https://hashnode.com/posts/what-are-double-shots-in-javascript/5f549038d34e0b0a2135b9ba/comment/5f55365cfb6cc91069300cf3)

I used to use

```
!!foobar
```

But now use

```
Boolean(foobar); // function, NOT object preceded by new
```

As it expresses the intent more clearly.

[FeStack](https://hashnode.com/@FeStack)

[Sep 6, 2020](https://hashnode.com/posts/what-are-double-shots-in-javascript/5f549038d34e0b0a2135b9ba/comment/5f54bc5cd34e0b0a2135babd)

Hi Akshay,

I use this a lot during coding. This is the best way to check null or undefined I guess.

[Akshay Sushir](https://hashnode.com/@axay)

[Sep 6, 2020](https://hashnode.com/posts/what-are-double-shots-in-javascript/5f549038d34e0b0a2135b9ba/comment/5f54bc5cd34e0b0a2135babd#reply-5f54bd2dd6e3120a423783e4)

Yes it converts 0, null or Undefined to Boolean true or false.
