This question already has an answer here:
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.
Aucun commentaire:
Enregistrer un commentaire