javascript - Or condition never evaluates to true -
this javascript code runs think doesn't make through "else" statement since doesn't print console...why?
= 0; for(var i=1; i<4; i++) { var crazy = prompt("would marry me?"); if(crazy === "yes"|| "yes") { console.log("hell ya!"); } /* when asks "will marry me" , if user says either "no" or "no", does't print "ok..i'' try again next time". instead, still says "hell ya !" */ else if (crazy ==="no" ||"no") { console.log("ok..i'll try again next time !"); } } var love = false; { console.log("nonetheless, love !"); } while(love);
try this..nice piece of code though.. marriage proposal geeky guy?
i = 0; for(var i=1; i<4; i++) { var crazy = prompt("would marry me?"); if(crazy === "yes"|| crazy ==="yes") { console.log("hell ya!"); } /* when asks "will marry me" , if user says either "no" or "no", does't print "ok..i'' try again next time". instead, still says "hell ya !" */ else if (crazy ==="no" ||crazy === "no") { console.log("ok..i'll try again next time !"); } } var love = false; { console.log("nonetheless, love !"); } while(love);