can anyone tell me what's wrong with this code? i want it to response with input 1 once the user type "no" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can anyone tell me what's wrong with this code? i want it to response with input 1 once the user type "no"

let input1 = prompt("hi! what's on your mind?") while (true) { input = prompt("is that really what you think?"); if (input === "no") { input = prompt(input1) } else if (input === "yes") { prompt("Okay!"); { break; } } }

13th Nov 2023, 8:22 AM
Maroua El Hattach
Maroua El Hattach - avatar
3 Answers
+ 3
It doesnt look like you've declared input correctly in the line under the while condition. Maybe save the code and attach it, like this guide says and then people can better help: https://code.sololearn.com/Wek0V1MyIR2r/?ref=app https://code.sololearn.com/W0uW3Wks8UBk/?ref=app
13th Nov 2023, 8:32 AM
Ausgrindtube
Ausgrindtube - avatar
0
i'm not quite sure how to correct that
13th Nov 2023, 9:38 AM
Maroua El Hattach
Maroua El Hattach - avatar
0
Debug: let input1 = prompt("hi! what's on your mind?") while (true) { input = prompt("is that really what you think?"); if (input === "no") { input = prompt(input1) } else if (input === "yes") { alert("Okay!"); // { - debug 1 break; // } - debug 2 } }
13th Nov 2023, 10:49 AM
Solo
Solo - avatar