+ 1
How can I stop additional prompts when I don't need them anymore?
Whenever I input «no» at the start, the code keeps running. How can I make it stop? https://code.sololearn.com/Wh3X8VQulWAA/?ref=app
1 Réponse
+ 1
Your entire code is not that efficient overall, for instance you could just use input.toLowerCase to avoid asking the user to use lowercase.
Another thing is that you should put actions in functions, then you also have the option to use the return keyword to exit the function.
Another solution is sorround the rest of the prompt with an if:
if (input == yes) {
} else if (input == no) {
}