JavaScript Tutorial

JavaScript If-else Statement (With Examples) –

The JavaScript if-else statement is used to execute the code whether condition is true or false. There are three forms of if statement in JavaScript.

  1. If Statement
  2. If else statement
  3. if else if statement

JavaScript If statement

It evaluates the content only if expression is true. The signature of JavaScript if statement is given below.

Flowchart of JavaScript If statement

if statement in javaScript

Let’s see the simple example of if statement in javascript.

 

Output of the above example



 

 

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button