JS Tutorial
Javascript-HomeJavascript-IntroductionJavaScript-File-UseJavascript-Output-ExampleJavaScript CommentJavaScript VariableJavaScript OperatorJavaScript ConsoleJavaScript StringJavaScript Conditional statement
Conditionals expression used to run the code when condition is true
condition can be either true or false boolean value
If else and else if
If else and else if use for conditional statement and if and else if statement run when condition is true otherwise else statement run when no one condition true
Example

if else and else if statement
if else and else if use for more than one condition check
Example

Ternary operator
Ternary operator is short form of if else and if else statement
Note : condition check ? "execute when condition is true" : "execute when condition false"
Example

Inner ternary operator
In case of inner ternary operator first inner ternary operator execute then outer ternary operator execute
Example

Switch statement
Switch statement is like a if else and else if and provide more condition check in single switch statement
Example

Note : if you do not use break keyword then all case run after true case
default statement run when no one cases are true