In Meteor tutorial project Microscope there is row with "!!" operator
Posts.allow({
  insert: function(userId, doc) {
  return !! userId; 
 }
});
What does it mean?
In Meteor tutorial project Microscope there is row with "!!" operator
Posts.allow({
  insert: function(userId, doc) {
  return !! userId; 
 }
});
What does it mean?
It's a boolean cast, from a fasly or truethy value to false or true respectively.
You might see:
var string = ""; // empty string is falsy
var bool = !!string; // false
falsy by the way means that it follows: myvar == false as opposed to false which follows: myvar === false (triple comparison).
Similarly truethy is myvar == true.
 
    
    The ! operator inverts a boolean, so by inverting a value two times, you get the same boolean. So true === !!true.
This often is used to convert a value into a boolean, as ! is guaranteed to return a boolean.
