Condition statements that are dependent on boolean value , this boolean is the decision factor either statements will execute or skip. The boolean expression is decision point of your code that decide
which branch will be executed first, you have seen a ladder in your home and a ladder in snake ladder game,
when you step up to the ladder , you nevigate to the destination you want to visit but when you stuck and find the snake on the way , you jump back to the
place where for example.
ifLadder=true
isSnakeCut=true
if(ifLadder){

} else if(isSnakeCut){
The following subsections explain JavaScript’s basic conditional, the if/else statement, and also cover switch, a more complicated,multiway branch statement.

While we are building the nginx server we obtained the "err.code=enoent",that specified that file not found, the root cause of error ,we have placed the file outside of root directory, so it can read pdf file from the same directory. This error is similar to the next example,we have provided ,we are out of stock for
apple and apple is the best.
alternative to long if-else-if, we also able to use switch in javascript

If statement has a flow and you can use if else ladder in case of performing multilingual translation switch
to call a sepecial service from your code. It is not best but switch will be more helpful here. The switch statement handles multiple values effeciantly.
This is not the best solution, however, when all of the branches depend on the value of the same expression. In this case, it is wasteful to
repeatedly evaluate that expression in multiple if statements.
switch(expression) {
case: "football":
play football
break
case: "cricket":
play cricket
break
default:
default is best to Sorry, we are not capable to handle your request.
}


Top comments (0)