If we have multiple if
statements, we can use the if-else if-else
structure for conditional statements. For the positive-negative-zero number example above, the JavaScript code will be,
xxxxxxxxxx
11
var x = 5
if (x > 0){
console.log("x is positive")
}
else if (x < 0){
console.log("x is negative")
}
else{
console.log("x is zero")
}
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment