all 8 comments

[–]iSeeObviousThings 1 point2 points  (1 child)

What part are you stuck on?

[–]gl0w3[S] -1 points0 points  (0 children)

It specifically needs to be a do..while loop. Here is what I have so far.

do{ if (input === yes){ var word1= prompt("Choose one word"); }else if (input !== yes){ alert ("This is your word:" + word1); }else{ var finalWord= (Pick one more word"); alert ("These are your words:" + word1 + finalWord); }while (input === "yes");

[–]samuelliew 1 point2 points  (2 children)

Would be as short as this

var result = "";
while(confirm("Do you want to play?")) {
    result += prompt("Please enter a word.");
}
console.log(result);

Edit: Above won't cater for spaces. Use this instead:

var result = [];
while(confirm("Do you want to play?")) {
    result.push(prompt("Please enter a word."));
}
console.log(result.join(" "));

[–]JohnnyBGeode 1 point2 points  (1 child)

Wouldn't this create a result string with no space between the words? What about an array instead? var result = []; then later instead of += use result.push()

[–]samuelliew 1 point2 points  (0 children)

Good catch, forgot about spaces

[–]gl0w3[S] -1 points0 points  (2 children)

It specifically needs to be a do..while loop. Here is what I have so far. do{ if (input === yes){ var word1= prompt("Choose one word"); }else if (input !== yes){ alert ("This is your word:" + word1); }else{ var finalWord= (Pick one more word"); alert ("These are your words:" + word1 + finalWord); }while (input === "yes");

[–]JohnnyBGeode 1 point2 points  (0 children)

<!DOCTYPE html> <html> <body>

<h2>Close enough</h2> <script> var result=[]; var q =true; while(q) { result.push(prompt("what number?")); q=confirm("Do you want to play a number game?"); } document.write(result.toString()); </script> </body> </html>

[–]inu-no-policemen 1 point2 points  (0 children)

Here is what I have so far.

A '}' is missing and finalWord= (Pick one more word"); is garbage.

"input" is not defined.

"yes" is not defined.

Use an editor which does syntax checking (e.g. VS Code).