Javascript If…Else

Statements execute within the order they’re found in a very script. so as to form helpful programs, it’s sometimes necessary to use flow management, code that governs the “flow” of program execution. JavaScript supports conditionals like if-else statements that allow the selective execution of piece of code.

Example of Javascript If…Else

<!DOCTYPE html>
<title>java script Language</title>
var a=5;
var b=5
alert(“The value of a and b is equal”);
alert(“the value are not equal”);


Result of Javascript If…Else :- The value of a and b is equal inside alert box.

Syntax :- 

if(expression) statements;

if(expression)   { statement;}   else {statement;}

if(expression)    { statement;}   else if (expression) statement…………;

if(expression)   { statement ; }  else if (expression) {statement; } else if(expression)    { statement;}    else {statement;}



Follow Us

Contact Us

Back to Top