JavaScript if else and else if

1/21/2020 6:59:30 AM

In this part we will discuss the condition part in the JavaScript section. If else is the most popular to use condition check. When we compeer something and check the value and write the output base on checking then we use if else condition. Also, this if else condition we use our need. Now given bellow the example code and explain the code:

<!DOCTYPE html>
<script type="text/javascript">
   // JavaScript if else condition
   // declire the variabole
   var num1=10;
   var num2=5;
   var num3=10;
   var num4=15;
// check the condition
 if (num1==num3) {
   console.log("Match the number one and number two!");
 else if(num2==num4){
  console.log("Match the number two and number fore!");
  console.log("dosent match!");


In this code we write four variable names as num1, num2, num3, num4 then we write the condition using if else and check the condition. Then print the value what we want to output.