Suppose you have an expression, which gives you a result.
You want this result to be a boolean. Either
Not a string, 0, an empty string, undefined, NaN or whatever.
!! operator does that.
And in reality it’s two negation operators one after the other. There’s no
It first negates the result of the expression, then it negates it again. In this way if you had a non-zero number, a string, an object, an array, or anything that’s truthy, you’ll get
Otherwise you’ll get
Here's my latest YouTube video. I talk about work/life balance as a developer: