The ! operator inverts a boolean:
!true // false
!false // true
Use it to check the opposite condition:
let isLoggedIn = false
if (!isLoggedIn) {
console.log("Please log in")
}
Double negation converts any value to its boolean equivalent:
!!"hello" // true (string is truthy)
!!0 // false (0 is falsy)