I am reading "Discover Meteor" at the moment, In chapter 7 is has code:
Posts.allow({
insert: function(userId, doc) {
// only allow posting if you are logged in
return !! userId; ///// <<==== what does "!!" means?
}
});
Thanks
Beautifully summed up by Tom Ritter as
// Maximum Obscurity:
val.enabled = !!userId;
// Partial Obscurity:
val.enabled = (userId != 0) ? true : false;
// And finally, much easier to understand:
val.enabled = (userId != 0);
therefore doing casting to a boolean and then doing double negation