[Refactoring] Javascript: if-else
Removed unreachable code