Name the different forms of if statement used
in JavaScript.
Answers
Answer:
In JavaScript we have the following conditional statements:
In JavaScript we have the following conditional statements:Use if to specify a block of code to be executed, if a specified condition is true.
In JavaScript we have the following conditional statements:Use if to specify a block of code to be executed, if a specified condition is true.Use else to specify a block of code to be executed, if the same condition is false.
In JavaScript we have the following conditional statements:Use if to specify a block of code to be executed, if a specified condition is true.Use else to specify a block of code to be executed, if the same condition is false.Use else if to specify a new condition to test, if the first condition is false.
Answer:
Use if to specify a block of code to be executed, if a specified condition is true
Use else to specify a block of code to be executed, if the same condition is false
Use else if to specify a new condition to test, if the first condition is false
Use switch to select one of many blocks of code to be executed