Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[JavaScript] Convert null to boolean using !!

As null belongs to the JS Falsy Values, you can simply do this:

console.log(null) // null

console.log(!!null) // false

Detailed explanation: https://www.samanthaming.com/tidbits/19-2-ways-to-convert-to-boolean/

Leave a Reply

Your email address will not be published. Required fields are marked *