1252748
1252748

Reputation: 15372

Why set value to true using !0

I've recently seen some script in which a property is being set to true using the following.

someProp: !0

I understand that this will evaluate to true, but don't understand why someone would set a property in this way. Is there a reason?

Upvotes: 1

Views: 63

Answers (1)

Rahul Tripathi
Rahul Tripathi

Reputation: 172408

I dont think there is any specific reason rather a matter of programming and writting code. Some people like things going crazy and I think this is one of them.

!1 means false and !0 - means true

Upvotes: 3

Related Questions