此JavaScript代码未执行

时间:2019-12-12 15:27:04

标签: javascript

所以我对JavaScript非常陌生。只是想知道为什么不执行此代码:

var x = 7
var y = 5
if (x < y) {
  alert("x is less than y")
}
else {
  alert ("x equal to y")
}
else if (x > y) {
  alert("x is greater than y")
}

1 个答案:

答案 0 :(得分:0)

if (x < y) {
  alert("x is less than y")
} else if (x > y) {
  alert("x is greater than y")
} else {
  alert ("x equal to y")
}