The example code runs through each condition sequentially, if a condition is not met it will go to the next ‘Else if’ statement.
This code will write “Value 2 condition met” in the console log
It won’t run the else { if (VALUE3 <301) section of the code.
var VALUE=100;
var VALUE2 = 200;
var VALUE3 = 300;
if(VALUE<101)
{ if(VALUE2<201)
{console.log("Value 2 condition met");} //The script will stop running here
else{ if(VALUE3<301) // These lines of script will not be run
{console.log("Value 3 condition met");}
}}
Code language: JavaScript (javascript)
