Obviously, these two samples achieve the same thing. But are there any, perhaps implementation-specific cases, where one could have better performance than the other?
Maybe a silly question, but this has got me thinking today.
Edit: The example uses strings but this can be anything, and my question has nothing to do with how fast a string comparison is etc.
if (something == 'something') {
return "something's up";
}
return;
vs
if (something != 'something') {
return;
}
return "something's up";