需要帮助Javascript with do while

时间:2014-09-01 09:17:13

标签: javascript loops while-loop

我需要一个“do while循环”,直到三个特定单词中的一个写在提示框中。

例如

do 
    var test = prompt("");
while test =! word1 word2 word3

当写出三个单词中的一个时,脚本应该继续。 我试着超过2个小时,但我仍然没有解决问题。

请帮忙。

2 个答案:

答案 0 :(得分:0)

试试这个。

while (test != word1 && test != word2 && test != word3) {
    var test = prompt();
}

答案 1 :(得分:0)

使用此:

while (test != word1 && test != word2 && test != word3)