Failed to stopping loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Failed to stopping loop

I tried to create a file that contains javascript while loop and data type validator. When the file runs, it will ask you integer numbers and when it's false, it will ask you again through prompted window Here's the problem : First, the loop can't be stopped even the value of tested variable is true. https://code.sololearn.com/W25p4I4Kglbh/?ref=app Second, what should I do if the value of a and b if they redirected to x and y? How to let a and b not counted because they don't have value? Note : please don't open the code if you don't want to get prompted loops

16th Dec 2020, 9:40 PM
Wijdan Insania Kuncoro
Wijdan Insania Kuncoro - avatar
10 Answers
+ 2
if you are right the value always gives false so it does not stop
17th Dec 2020, 12:09 AM
Daniel Briceño
Daniel Briceño - avatar
+ 2
And what if you try if else in while (true) to stop it
17th Dec 2020, 12:10 AM
Daniel Briceño
Daniel Briceño - avatar
+ 1
I added the second '=' thanks
16th Dec 2020, 10:23 PM
Wijdan Insania Kuncoro
Wijdan Insania Kuncoro - avatar
+ 1
Good night, would you like me to give you the code already solved or would you like me to tell you where the error is?
17th Dec 2020, 12:07 AM
Daniel Briceño
Daniel Briceño - avatar
+ 1
Daniel Briceño the loop, it can't stop even the value is true
17th Dec 2020, 12:08 AM
Wijdan Insania Kuncoro
Wijdan Insania Kuncoro - avatar
+ 1
example: a=prompt(); if(a)//condicion continue; else a=parseInt(a);
17th Dec 2020, 12:12 AM
Daniel Briceño
Daniel Briceño - avatar
+ 1
I'm going to try it
17th Dec 2020, 12:13 AM
Wijdan Insania Kuncoro
Wijdan Insania Kuncoro - avatar
+ 1
How are you doing with the code if you want I give you my solution but the question is that you solve it yourself. Do you want my solution?
17th Dec 2020, 2:13 AM
Daniel Briceño
Daniel Briceño - avatar
+ 1
Sure, I will find the mistake and retry it
17th Dec 2020, 2:14 AM
Wijdan Insania Kuncoro
Wijdan Insania Kuncoro - avatar
+ 1
Good luck
17th Dec 2020, 2:30 AM
Daniel Briceño
Daniel Briceño - avatar