+ 1
JS prompt - calculator (ΠΊΠ°Π»ΡΠΊΡΠ»ΡΡΠΎΡ)
Help me, please. How to do in the calculator if you have not entered a number, then offer to enter again until you enter a number. And that would not count either 0 or nan. ΠΠΎΠΌΠΎΠ³ΠΈΡΠ΅ ΠΌΠ½Π΅, ΠΏΠΎΠΆΠ°Π»ΡΠΉΡΡΠ°. ΠΠ°ΠΊ Π² ΠΊΠ°Π»ΡΠΊΡΠ»ΡΡΠΎΡΠ΅ ΡΠ΄Π΅Π»Π°ΡΡ Π΅ΡΠ»ΠΈ Π²Π²Π΅Π»ΠΈ Π½Π΅ ΡΠΈΡΡΡ, ΡΠΎ ΠΏΡΠ΅Π΄Π»Π°Π³Π°ΡΡ Π΅ΡΠ΅ ΡΠ°Π· Π²Π²Π΅ΡΡΠΈ, ΠΏΠΎΠΊΠ° Π½Π΅ Π²Π²Π΅Π΄Π΅Ρ ΡΠΈΡΡΡ. Π ΡΡΠΎ Π±Ρ Π½Π΅ ΡΡΠΈΡΠ°Π» ΠΈΠ»ΠΈ 0 ΠΈΠ»ΠΈ nan.
6 Answers
+ 5
Ok, here's my solution, I'm using the do...while statement:
https://code.sololearn.com/W45ToHTR466g/?ref=app
+ 5
ΠΠ°ΡΠΈΠ½Π° ΠΠΎΡΠ΄ΠΈΠ½ΡΠΊΠ°Ρ Try do{...}while(!val)
+ 4
I can't open the code, please insert it clicking the insert button.
+ 1
Thank you, this is what I need. What can you do with the cancel function? If you press it, it counts 0
+ 1
Thanks, I'll try