Not Not in Javascript

Javascript has a peculiar way of converting non booleans to a boolean value.

Came across an expression as
[crayon-5ba526b5c9b04211060228/] where current_user will be null unless user has logged in.

Mozilla docs mention that ! operation
[crayon-5ba526b5c9b14664563475/]

[crayon-5ba526b5c9b1b538602579/]

A null value got converted to false.

Read more on stackoverflow here and here

Read Also:  Android: Localization

Leave a Reply

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