0
How to use if statement in js
4 Answers
+ 3
if (condition) {
//Statements go here
}
0
If statements in JS are conditional statements just like in other languages. What dont you understand specifically?
e.g.
if(condition){ // if something is true, e.g if x===1, then...
//execute this block of code
}
//if x === 1 is not true, ignore the above block of code and...
// run this other code...
Like that.Hope its clear
0
if (condition) {
statements
}
Example:
var x==1;
if (x==1) {
document.write("x is equal to 1");
}
0
if (something happens) {
Do something
}