How If Else using
For correct use if else you should to use next construction:
if (a==1) {
...
} else if (a==2) {
...
} else {
...
}
For example:
var a = 1;
if (a==1) {
//execute
} else if (a==2) {
//not
} else {
//not
}
var b = 2;
if (b==1) {
//not
} else if (b==2) {
//execute
} else {
//not
}
var c = 3;
if (c==1) {
//not
} else if (c==2) {
//not
} else {
//execute
}