The if else Statement part 1

The else Statement



Use the else statement to specify a block of code that will execute if the condition is false.if (expression) {
// executed if condition is true
}
else {
// executed if condition is false
}

You can skip curly braces if your code under the condition contains only one command.
The "else" statement is created to:

Test a new condition for true or false
Tell JavaScript to execute something if the condition is false
Ignore the condition testing

Comments

Popular posts from this blog

Comparison Operators part 2

Break and Continue part 1

Module 2