In JavaScript, the double exclamation operator converts an Object to Boolean. This happens such that “falsy” objects become false and “truthy” objects become true.
For example:
!! 0 –> false
!! null –> false
!! undefined –> false
!! 48 –> true
!! “hello” –> true
!! [1, 2, 3] –> true
This is a comprehensive guide on the double exclamation point operator.
references:
https://www.codingem.com/javascript-double-exclamation-operator/#:~:text=In%20JavaScript%2C%20the%20double%20exclamation,%E2%80%9Ctruthy%E2%80%9D%20objects%20become%20true.
No comments:
Post a Comment