What is the !! (not not) operator in JavaScript?
Asked 07 September, 2021
Viewed 1.9K times
  • 61
Votes

I saw some code that seems to use an operator I don't recognize, in the form of two exclamation points, like so: !!. Can someone please tell me what this operator does?

The context in which I saw this was,

this.vertical = vertical !== undefined ? !!vertical : this.vertical;

30 Answer