gpt4 book ai didi

Javascript算法错误3

转载 作者:行者123 更新时间:2023-11-30 15:14:59 25 4
gpt4 key购买 nike

我已经写下了这段代码,就像一个有密码的小游戏,我希望如果他写对了密码,或者写完了,那么它就真的结束了,向我们显示一条消息,但万一他写了其他东西或它继续询问的任何内容,但它并不完全正确。

 do{
var password = prompt("What is the password? Just give up by typing end, you won't find it, heheeh.")
if(password == "I11I1II1I"){
window.alert("Ok, ahha, so fun, going to the code, and searching for the password, yes yes yes good job, you won, yey")
}
else if(password == "end"){
window.alert("Bye Bye, ehhe.")
}
else{
window.alert("I don't know how you found me, but hey, you won't find the password, eehhehe.")
}
}
while((password == "") || (password != "I11I1II1I") || (password != "end"))

最佳答案

你虽然逻辑不对,你应该在密码为""(password != "I11I1II1I"&& password != "end")时提示

do{
password = prompt("What is the password? Just give up by typing end, you won't find it, heheeh.")
if(password == "I11I1II1I"){
window.alert("Ok, ahha, so fun, going to the code, and searching for the password, yes yes yes good job, you won, yey") ;
}
else if(password == "end"){
window.alert("Bye Bye, ehhe.") ;
}
else{
window.alert("I don't know how you found me, but hey, you won't find the password, eehhehe.");
}

}
while((password == "") || (password != "I11I1II1I" && password != "end"))

关于Javascript算法错误3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44606996/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com