Truthy & Falsy Values
What is the result of !![] in JavaScript?
The result of !![] is true. The double negation (!!) is a common idiom to convert a value to its boolean equivalent. First, ![] evaluates to false because the ! operator negates the truthiness of the empty array (which is truthy). Then, !false evaluates to true. This is equivalent to Boolean([]), which also returns true. This pattern is often used when you explicitly want a boolean result rather than the value itself. It's important to remember that arrays in JavaScript, even empty ones, are truthy, unlike some other programming languages where empty collections might be considered falsy.