0

How to stop the code from going to the other step if the user didn't enter their name?

I want the code to stop the from going to the other function if the user didn't enter their name and to ask the user for their name again https://code.sololearn.com/WLNO3HU09doJ/?ref=app

6th May 2021, 6:46 PM
Radwa Hamdy
4 Réponses
+ 3
let name = ""; while(!name){ name = prompt("enter your name") }
6th May 2021, 7:02 PM
Solo
Solo - avatar
+ 1
Vasiliy Thanks
6th May 2021, 7:03 PM
Radwa Hamdy
0
You can use 'required'.
6th May 2021, 6:52 PM
Rajanit Nagajibhai Navapara
Rajanit Nagajibhai Navapara - avatar
0
Rajanit Nagajibhai Navapara It is prompt not an input feild
6th May 2021, 6:53 PM
Radwa Hamdy