ELSEIF condition not working with IF and ELSE in Javascript
I would like to use ELSEIF statement to set a condition in Javascript, but it is not working. Would you please tell me what is incorrect ?
IF (value==1) {
var a = 1;
} ELSEIF (value==2) {
var a = 2;
} ELSE {
var a = 0;
}
Hi,
To make it work you have to replace "ELSEIF" with "ELSE IF". ELSEIF is used in PHP. In Javascript is used ELSE IF function. The code should look like:
IF (value==1) {
var a = 1;
} ELSE IF (value==2) {
var a = 2;
} ELSE {
var a = 0;
}
1 answer