My Function Is Broken It Seems Javascript -
basically no matter enter when call function says have fled. may overlooking can't figure out what.
function attack() { var battle = prompt("attack of flee?") if (battle === "flee" || "flee") { alert("you have fled"); } else if (battle === "attack" || "attack"){ alert("you have attacked"); } }
try if (battle === "flee" || battle === "flee")
right hand side evaluating string "flee" truthiness, evaluates true
.
Comments
Post a Comment