It really matters the same thing.
But, wait! It's really different thing when we use to test true or false:
err = 'This is also to be a true if you convert it to boolean';
if(!!err == 1){
console.log('test by converting to boolean');
}
if(err == 1){
console.log('a real boolean test');
}
//outputs only: test by converting to boolean
But a real boolean value logs both as in the following example:
err = true;
if(!!err == 1){
console.log('test by converting to boolean');
}
if(err == 1){
console.log('a real boolean test');
}
So double exclamation sign is used to convert to a boolean only.
So, people use the condition to make sure the value is in boolean or not and if it's not then convert it and check it but if he wanted to check strictly that is true or not then he'll compare using 1 === 1
and in the above example exactly the same thing is being applied.
But just like in your code if(!!err){
is used to make sure it is false or true because of lack of deep knowledge that if(err){//string
even can be checked as true or false.
That's it. The exactly check is made by !!
.