what are the different control statements found in JavaScript
Answers
Answered by
2
The if/else statement executes a block of code if a specified condition is true. If the condition is false, another block of code can be executed.
The if/else statement is a part of JavaScript's "Conditional" Statements, which are used to perform different actions based on different conditions.
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
Use switch to select one of many blocks of code to be executed
Similar questions
Social Sciences,
6 months ago
Geography,
6 months ago
Science,
6 months ago
Physics,
11 months ago
Computer Science,
1 year ago
Social Sciences,
1 year ago