【发布时间】:2014-07-02 23:11:41
【问题描述】:
请帮忙。当使用 console.log 语句运行代码时,它会在提示符 snd 中输入数字,然后单独记录答案,return 语句显然无效。
prompt("You begin to move but as you evade most of the bullets some of them hit your " + bodyPart + " you begin to feel the blood shushing out, As people realize what happened there begins to be chaos. You look at the direction of the bullets to find 3 guys with heavy weaponry. They are almost done reloading. will you take COVER behind a table, RUN out of the place, or... suddenly you hear the girl telling you 'Take cover'... FIGHT them?").toUpperCase()
var bodyPart = Math.random()
if (bodyPart > .75){
bodyPart = "Right Arm"
}
else if (bodyPart > .50){
bodyPart= "Left Arm"
}
else if (bodyPart >.25){
bodyPart = "Right Leg"
}
else{
bodyPart = "Left Leg"
}
【问题讨论】:
-
请更具描述性,可能发布整个代码,甚至可能发布一个显示问题的 jsfiddle。
标签: javascript if-statement prompt