Unfamiliar Operator

I am very new to Meteor (but not new to JavaScript) and am working my way through the Discover Meteor book.

I just encountered this section of code in the Creating Posts chapter:

Posts.allow({
  insert: function(userId, doc) {
    // only allow posting if you are logged in
    return !! userId;
  }
});

Either I am seeing things and am really in need of a break from looking at code, or this line contains an operator I’m unfamiliar with:

return !! userId;

What is the !! operator?

1 Like

it’s equivalent to the !!!! operator, e.g !!aee === !!!!aee, specific to Meteor which is why you haven’t seen it before. Welcome to the community :wink:

2 Likes

this !!(is) a great answer