vendredi 6 août 2021

Simplest way to add a restart in JS

Maybe not the best way, but what is the simplest way to add a restart to a if/else chat with limited JS knowledge?

E.g. If my chat asks someone Hi, do you like ice cream? And I only give the if options to yes or no, and they type in blah.

I want it to return saying something like sorry I don't understand, I'll ask the question again.

What code do I use to have it restart back to the question?

So far I've got:

const restart = () => {
level 2;
path = ;
return "sorry, wrong answer. I'll ask again"
{

What do I put in the path to make it start back at my level 2 question?

Thanks very much in advance

Aucun commentaire:

Enregistrer un commentaire