Current scheme:

Light

How does if work in JavaScript?

if statement is used to determine wether some code will run or not, based on a passed condition.

For example, the code in first if will run, but the second won't

if (5 == 5) {
console.log("I will run!");
}
if (5 != 5) {
console.log("I will run!");
}

Select a scheme: