Consider a function like this:
const someFunction = () => {
if(someCondition) {
return 'something';
} else {
return 'nothing';
}
}
and if I wrote it this way:
const someFunction = () => {
if(someCondition) {
return 'something';
}
return 'nothing';
}
Now both of them do the same thing and in the latter function because of the return keyword the part below the if statement doesn't get executed.
Aside from how they look will there be a performance difference between the above two functions?
Aucun commentaire:
Enregistrer un commentaire