I am working on a project which requires some pretty intricate JavaScript processing. This includes a lot of nested if
-else
s in quite a few places. I have generally taken care to optimise JavaScript code as much as possible by reading the other tips on Stack Overflow, but I am wondering if the following two constructs would make any difference in terms of speed alone:
if(some_condition) {
// process
return ;
}
// Continue the else condition here
vs
if(some_condition) {
// Process
}
else {
// The 'else' condition...
}