What is the use if else statement?


#1

Hi
I don't understand the use of if else statement, I didn't find any difference even if I remove if else statement.

Replace this line with your code.


#2

The structural form of an if statement is,

if (condition) {
    // code to run if condition is true
} else {
    // code to run otherwise (default)
}

Control flow follows the branch that applies.

if - else is an invaluable decision making tool. The condition may be any expression, logical, comparison, string or number.

If you have no background knowledge of JavaScript then it might not be a bad idea to immerse yourself in the JavaScript track to familiarize yourself with the basic concepts of the language, and of programming in general.


#3

I know what is if else statement and how it works. Iam asking what is the use of else statement in that particular code.


#4

Please post a link to the exercise. Thanks.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.