I am writing a code using WebStorm IDE, and I wrote an
if statement
in a method like this:
createEvent():boolean {
return this.http.post('/event', { params: {name , location} }).map(res => res.json()).map(res => {
if(event && event.success){
return true;
}
return false;
});
}
Then the IDE suggest I rewrite (simplify) the if statement this way:
createEvent():boolean {
return this.http.post('/event', { params: {name , location} }).map(res => res.json()).map(res => {
return !!(event && event.success);
});
}
I find it confusing while the system uses a double NOT sign.
Please I need some explanation.