It's good, if you don't have anything to do in else or no need or able to mange without else.
Each statement increase your execution time and also compile time. So if you able to reduce number of statements and expressions, you saving execution time and also compile time.
let var1 = 10; // during the declaration initialise the variable, act as else variable
if (condition == true) {
var1 = 20;
}
So here number of statement going to execute
1. declare variable and initialize.
2. Verify if case
3. Execute If case block
Total Time need (each statement need 1 unit) is 3unit
1. declare variable and initialize
2. Execute if case
Total Time need(each statement need 1 unit) is 2 unit
Now consider following code
if (condition == true) {
var1 = 20;
} else {
var1 = 10;
}
Total statement going to be 5, one for declare variable and assign with garbage value
And number of statement going
1. Declare variable
2. Execute if statement, to evaluate true
3. Execute if code(var1=20)
Total time need(ie: each statement need 1 unit) is 3unit
-if statement not execute: Statement sare
1. Declare variable
2. Execute if statement, to evaluate false
3. Move to else block
4. Execute else code(var1=10)
Total time need(ie: each statement need 1 unit) is 4unit